IFTHENELSE(1)

πŸ“¦ version 2.9.9.2, in nixpkgs unstable

🌸 NAME 🌸

The General Commands Manual page IFTHENELSE(1) is all about ifthenelse(1) β€” perform a conditional alternative, bestie!! πŸ’… It’s the β€œpick a path” girlie of execline, and yes, she ate. ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

In an execlineb(1) script:

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

✨ DESCRIPTION ✨

Okay so ifthenelse reads progif..., progthen..., and progelse... in 3 consecutive blocks (cf. execline-block(7)). Three blocks, three vibes, one conditional. πŸŽ€

First up: it runs progif... as a child process and waits for it to complete. Like, actually waits. πŸ‘‘

If progif... crashes β€” i.e. it’s killed by a signal β€” ifthenelse prints an error message, then exits 128 plus the number of the signal that killed progif. That’s the dramatic part, and yes, it means exactly what it says. πŸ’€

If progif... exits zero, ifthenelse runs progthen... as a child process; else it runs progelse.... Simple as that, no cap. 🌈

Then ifthenelse waits for its child to complete and puts the exit status in the ? environment variable. After that, it exec(3)s into prog.... Bye bestie, it’s prog...’s turn now. 🫢

πŸ’… OPTIONS πŸ’…

  • -X β€” if progif crashes, do not exit; proceed as if it had returned false. πŸ™ˆ
  • -s β€” magic scoping hack. This option does powerful but ugly things, and is left undocumented on purpose. So obviously we’re not gonna spill the tea; it’s on purpose. πŸ’€

🌟 SEE ALSO 🌟

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 ✨

πŸ‘‘ AUTHORS πŸ‘‘

Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)


And that’s the whole page, bestie!! πŸŽ€ This iconic page was brought to you by Debian, dated February 14, 2021 β€” mwah, kisses, happy scripting!! πŸ’–

πŸ“¦ where this page comes from