IFTE(1)

πŸ“¦ version 2.9.9.2, in nixpkgs unstable

ifte(1) β€” perform a conditional alternative πŸ’…

okay so bestie, welcome to the ifte page β€” it's giving "choose your own adventure" but make it Unix ✨


✨ SYNOPSIS ✨

In an execlineb(1) script:

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

🌸 DESCRIPTION 🌸

okay so picture this: ifte peeks at progthen... and progelse... sitting in two back-to-back blocks (shoutout to execline-block(7) for that whole situation) πŸŽ€

then it runs progif... as a child process and just… waits for it to finish. patient queen behavior πŸ’…

now here's the drama: if progif... crashes (like, gets killed by a signal 😭), ifte prints an error message and then exits with 128 plus the number of the signal that killed progif. no cap, that's the whole vibe check.

if progif... exits zero? slay, ifte exec(3)s into progthen... πŸ”₯

otherwise? it exec(3)s into progelse.... the plot twist we deserved πŸ¦‹

also important: ifte is literally the simpler version of ifthenelse(1). it only does conditional execution, not the whole instruction sequence thing. it's giving "less is more" energy ✨

and for the record, this:

ifthenelse { progif } { progthen } { progelse } remainder

is the equivalent of:

foreground { ifte { progthen } { progelse } progif } remainder

iykyk 🫢


πŸ’– OPTIONS πŸ’–

  • -X β€” do not exit if progif crashes. instead, just proceed as if the test had returned false. like, "we move" energy πŸ’€
  • -n β€” negate the test. progthen... will be run iff progif... exits nonzero. chaotic? maybe. iconic? absolutely πŸ‘‘

🌈 SEE ALSO 🌈

background(1), backtick(1), execlineb(1), foreground(1), if(1), ifelse(1), ifthenelse(1), pipeline(1), runblock(1), exec(3), execline-block(7)


this man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/ifte.html β€” go show it some love πŸ’œ

πŸ‘‘ AUTHORS πŸ‘‘

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

okay that's the whole page bestie, go forth and conditionally execute βœ¨πŸ¦‹πŸ’–

β€” Debian, February 14, 2021, IFTE(1) β€” periodt πŸ’…

πŸ“¦ where this page comes from