pkgsrc-Users archive

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

Re: Understanding this code



    Date:        Fri, 2 Oct 2026 07:41:15 -0000 (UTC)
    From:        mlelstv%serpens.de@localhost (Michael van Elst)
    Message-ID:  <119nn6r$ekv$1%serpens.de@localhost>

  | exec means that the gm command is replacing the shell, it's
  | the last command executed. The script only continues if
  | the gm command couldn't be executed at all (e.g. it's not
  | found in the PATH).

Not then either, in a non-interactive shell (standard shell anyway)
if an exec fails, the shell exits (after printing an error, etc).

bash (at least) has an option (one of its shopt type options,
rather than a set -Q type one) to alter that behaviour, so if
the command came from a bash script, and that script set that
option (shopt -s execfail) then it would continue.   Some other
shells might have similar faclities.   Our /bin/sh doesn't.

kre


Home | Main Index | Thread Index | Old Index