nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] folder -nocreate +/this/does/not/exist

2016-08-29 09:14:25
Ralph Corderoy <ralph(_at_)inputplus(_dot_)co(_dot_)uk> writes:
Hi David,

    $ mhparam folder
    -nocreate
    $ folder +/this/does/not/exist
    $ echo $?
    1

I'd expect something on stderr.

Well, the man page doesn't promise that

No, I quite agree.  Didn't meant to imply it did.

I think the non-zero exit status is sufficient.  Esp. in scripts.

Well, folder(1) is kind of cd and mkdir in one.  With -nocreate, I'm
cd-ing to the folder, and cd complains when the directory's missing.  I
agree I should notice the lack of "/this/does/not/exist+ has no
messages.", but the Unix norm is silence if all's well so I've been
conditioned.  My following commands, in the wrong folder, can wreak
havoc.  :-)

I am hardly an expert bash programmer, but

I customarily begin all my bash scripts with

  set -eu

So if an error does occur I may not know the cause but havoc will be
less likely wrecked.  If want a bit more information I can write something
like:

 set -eu
 trap "echo >&2  $0: Something is rotten in Denmark" 1 2 3 8


If I want to ignore the error status of a command
I can write

  command || true

where true is any command which had no effect and returns no error.



    Norman Shapiro

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>