execline
Software
skarnet.org

# The `ifte` program

`ifte` performs a conditional alternative.

## Interface

In an execlineb script:

         ifte [ -X ] [ -n ] { progthen... } { progelse... } progif...

- `ifte` reads progthen... and progelse... in two consecutive blocks.
- `ifte` runs progif... as a child process and waits for it to complete.
- If progif... crashes (i.e. is killed by a signal), `ifte` prints an error message, then exits 128 plus the number of the signal that killed progif.
- If progif... exits zero, `ifte` execs into progthen..., else it execs into progelse....

## Options

- `-X` : do not exit if progif crashes; instead, proceed as if the test had returned false.
- `-n` : negate the test. progthen... will be run iff progif... exits nonzero.

## Notes

`ifte` is a simpler version of ifthenelse. It performs only conditional execution, not instruction sequence.

"`ifthenelse { progif } { progthen } { progelse } remainder`" is the equivalent of "`foreground { ifte { progthen } { progelse } progif } remainder`".