tech-userlevel archive

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

Re: rmdir -p

On Mon, May 19, 2008 at 12:50:41PM -0400, der Mouse wrote:
> A leading - was added to make specifically to express the semantics of
> "ignore errors from this command".  || says "do this, and then, if it
> fails, do that".  That using it with an always-successful command as
> the RHS has the effect of ignoring failures from the LHS is a side
> effect of its primary purpose, via a comparatively little-known aspect
> of its definition - that the exit status of the || construct is the
> exit status of the last-executed command.

|| true is also the standard way to deal with it when using set -e.
That is done as part of many important macros like ${RUN} in pkgsrc and
therefore using the || true construct is preferable as it means that
moving the statement around etc will not change the semantic.


Home | Main Index | Thread Index | Old Index