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

Re: Interesting problem in timezoneconf package



On Sun, 2003-07-27 at 12:44, Colin Watson wrote:
> I tested this before posting. No, -e is a little more forgiving than
> that, as stated in bash(1):
> 
>               -e      Exit  immediately if a simple command (see SHELL
>                       GRAMMAR above) exits  with  a  non-zero  status.
>                       The  shell  does  not  exit  if the command that
>                       fails is part of an until or while loop, part of
>                       an  if statement, part of a && or || list, or if
>                       the command's return value is being inverted via
>                       !.   A  trap  on ERR, if set, is executed before
>                       the shell exits.

I just tested this too, because I thought that one had to do

   [ "$CTL" != "yes" ] || takeaction

rather than

   [ "$CTL" = "yes" ] && takeaction

when -e was set in order to avoid immediate exit on the failure
of the "$CTL"="yes" test.  Experiments prove that neither of
these causes immediate exit, even though the second one does
have a nonzero status when "$CTL" != "yes".

--
Thomas




Reply to: