[vox-tech] bash, short circuit logic, and errexit

Steve Wormley steve at wormley.com
Fri Jan 18 11:58:19 PST 2008


On 1/18/08, Bryan Richter <bryan.richter at gmail.com> wrote:
> Does everyone agree that the following script shouldn't last forever?
> And if you agree, does it last forever nonetheless?
>
> ----------
> #!/bin/bash
>
> set -e
>
> false && false;

The man page states(for set -e)

The shell does not
exit  if  the  command that fails is part of the command
list immediately following a  while  or  until  keyword,
part  of the test in an if statement, part of a && or ││
list, or if the command's return value is being inverted
via  !.

So, no, your script shouldn't exit.

-Steve


More information about the vox-tech mailing list