Hacker News new | ask | show | jobs
by KerrickStaley 126 days ago
A fun way to play this game with less downside is to run `set -euo pipefail` in an interactive session. Then, whenever you execute a command that returns a non-zero exit code, your shell will exit immediately.

Unfortunately certain commands like `rg` will return non-zero by design when there are no matches, which could be an intentional outcome.

1 comments

Just remember what those commands are, and to type a || or && next to them each time you run one.

'<cmd> || echo$?' is a good option, if you care about the return value.