OR(1)

πŸ¦‹ or(1) β€” the fish-shell "bestie, that didn't work" command πŸ’…

okay so picture this: or is the fish-shell command that's like "hey, if the last thing flopped, do this instead." it's giving backup plan energy. ✨


✨ SYNOPSIS ✨

COMMAND1; or COMMAND2

πŸ’– DESCRIPTION πŸ’–

or runs a command only if the previous command was not successful β€” meaning it returned a status of something other than 0. so 0 = slay, anything else = uh oh, run the next one 🫢

or statements can also be used as part of the condition in an if block or a while block. yes bestie, it's flexible like that 😌

now this part is important: or itself does not change the current exit status. but the command it runs most likely will. and like, the exit status of the last foreground command to exit can always be accessed using the $status variable β€” iconic, no cap πŸ’―

the -h or --help option displays help about using this command. go off, get yourself some help πŸ’…


πŸŽ€ EXAMPLE πŸŽ€

so here's the vibe: this following code runs the make command to build a program. if the build succeeds, the program is installed. and if either step fails, make clean is run β€” which removes the files created by the build process. cleanup queen behavior fr fr 🧹✨

make; and make install; or make clean

🌈 SEE ALSO 🌈

  • and command β€” the other half of this dynamic duo 🫢

πŸ‘‘

Copyright β€” fish-shell developers. respect the devs, they ate πŸ“

and that's the whole page, bestie β€” dropped Sep 08, 2026, version 4.9 of the fish-shell docs. go forth and chain your commands πŸ’œπŸŽ€

πŸ“¦ where this page comes from
  • arch rolling: fish 4.9.3-1 Β· GPL-2.0-only AND BSD-3-Clause AND ISC AND MIT AND PSF-2.0
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms