execline
Software
skarnet.org
The if program
if performs conditional execution.
Interface
In an execlineb script:
if [ -X ] [ -n ] [ -t | -x exitcode ] { prog1... } prog2...
- if reads prog1... in a
block. It forks and executes it,
then waits for it to complete.
- If prog1 crashes, if prints an error message
then exits 128 plus the number of the signal that killed prog1.
- If prog1 exits a non-zero status,
if exits 1.
- Else if execs into prog2.
Options
- -X : treat a crash of prog1 as a non-zero ("false") exit.
- -n : negate the test (exit on true, exec into prog2 on false)
- -x exitcode : exit exitcode instead of 1 if the test fails.
- -t : exit 0 instead of 1 if the test fails.
This is equivalent to -x 0.
Notes