LOOPWHILEX(1)

πŸ“¦ version 2.9.9.2, in nixpkgs unstable

✨ LOOPWHILEX(1) ✨

from the General Commands Manual, bestie 🫢

🌸 NAME 🌸

loopwhilex β€” perform a conditional loop πŸ’–

πŸ¦‹ SYNOPSIS πŸ¦‹

loopwhilex [-n] [-o okcodes | -x breakcodes] prog...

πŸ’… DESCRIPTION πŸ’…

Okay so loopwhilex runs prog... as a child process and waits for it to complete. Simple cute beginning, right?

As long as prog exits zero, loopwhilex runs it again. Slay, it's looping.

Then loopwhilex exits with an approximation (cf. execline-exitcodes(7)) of the last prog invocation's exit code. Iconic exit behavior, lowkey.

loopwhilex prog... is equivalent to loopwhilex -n -x 0 prog... and loopwhilex -o 0 prog.... No cap, that's the equivalence.

Be careful, bestie: execline maintains no state, in particular it uses no real variables, and environment will be of no use here since every instance of prog... runs as a separate child process. To avoid being stuck in an infinite loop, prog... should modify some external state β€” for instance, the filesystem. This is the part where you do not ignore me, fr fr. 😭

πŸŽ€ OPTIONS πŸŽ€

  • -o okcodes β€” okcodes must be a comma-separated list of exit codes. loopwhilex will keep looping as long as prog exits with one of the codes in okcodes. πŸ’–
  • -x breakcodes β€” Like the previous option, but with inverted meaning β€” the listed exit codes are codes that will break the loop and exit, and the unlisted exit codes will keep the loop running. πŸ¦‹
  • -n β€” Negate the test. This option is now redundant, and may disappear soon. ⚠️

🌈 SEE ALSO 🌈

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

πŸ‘‘ AUTHORS πŸ‘‘

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

πŸ’– Cute little sign-off: this is from Debian, dated February 14, 2021, and it's the LOOPWHILEX(1) page, periodt. Mwah! πŸ’–

πŸ“¦ where this page comes from