News for hackers. Stuff that matters.
Re:Using GPG to Encrypt Your Data by txutxu on Thursday January 12, 2017 @11:59AM (#13383883)
Regarding the code...

    set -euf
    onecmd --args "$@"
The set -u is unneeded, as there are no code variables involved.

The set -e is not needed, as there is only one command, and the script will return the exit status of such command. Always. And will exit after that command. Always.

The set -f, will disable globbing, which I'm not sure it's what you want, when using a simple wrapper passing "$@" as filenames to gpg...

Re:Using GPG to Encrypt Your Data by nothrabannosir on Thursday January 12, 2017 @01:18PM (#13384656)
I disagree. set -eu should be at the top of every bash script.

This is the classic braceless if-guard mistake; leave it out today because you don't need it, forget, add something tomorrow and it breaks.

Re:Using GPG to Encrypt Your Data by switch007 on Thursday January 12, 2017 @02:38PM (#13385368)
You can over-rely on "set -e" however:

  #!/usr/bin/env bash
  set -e
  fail() { false ; echo hello; }
  if ! fail; then :; fi
That outputs "hello" and exits with 0.
Re:Using GPG to Encrypt Your Data by Wilya on Thursday January 12, 2017 @12:56PM (#13384461)
Not the author of the code, but personally, I don't see any downside to putting "set -eu" at the beginning of every script I write. These should be defaults.
Re:Using GPG to Encrypt Your Data by jph on Friday January 13, 2017 @10:41AM (#13391604)
You're correct. I use -euf as a default for new scripts, until someone asks for relaxing these. I'll remove the -f now because you're right, globbing can be useful.