[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: norm
Subject: Re: [Nmh-workers] folder -nocreate +/this/does/not/exist
Date: Mon, 29 Aug 2016 07:14:07 -0700

Ralph Corderoy <address@hidden> 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

 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]