Post #995259
2026-03-13 17:29 UTC
Tip for Linux shell beginners: Execute a second command only if the first one failed.
`command_1 || command 2`
Background: This compound command uses the result code returned by `command_1` with the "shortcircuit" behaviour of the "logical OR" `||` operator.
#Linux #Shell #Terminal
Replies (2)
-
@monospace@floss.social 2026-03-13 18:18
@gumnos I would turn this into a script to use daily if I hadn't headphones plugged in all the time.
-
@monospace@floss.social 2026-03-13 18:40
@gumnos Yup, that's more like it! Also helps with getting out of that chair once in a while.