ifthenelse - perform a conditional alternative

IFTHENELSE(1) BSD General Commands Manual IFTHENELSE(1)


ifthenelse — perform a conditional alternative


In an execlineb(1) script:

ifthenelse [−X] [−s] { progif... } { progthen... } { progelse... } prog...


ifthenelse reads progif..., progthen... and progelse... in 3 consecutive blocks (

cf. execline-block(7) ).

ifthenelse runs progif... as a child process and waits for it to complete.

If progif... crashes (i.e. is killed by a signal), ifthenelse prints an error message, then exits 128 plus the number of the signal that killed progif.

If progif... exits zero, ifthenelse runs progthen... as a child process, else it runs progelse....

ifthenelse waits for its child to complete and puts the exit status in the ? environment variable. It then exec(3)s into prog....


If progif crashes, do not exit; proceed as if it had returned false.


Magic scoping hack. This option does powerful but ugly things, and is left undocumented on purpose.


background(1), backtick(1), foreground(1), if(1), ifelse(1), ifte(1), pipeline(1), runblock(1)

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/ifthenelse.html


Laurent Bercot
Alexis <

[email protected] > (man page port)

BSD February 14, 2021 BSD

Updated 2023-02-15 - jenkler.se | uex.se