Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by xorcist

2 days ago

In this specific case, echo can't fail to there's no need for any of that:

  [ -z "$1" ] && echo "fail" >&2 && exit 1

1 comment

xorcist

Reply

layer8  2 days ago

Echo will fail here when stderr is closed. For example when the caller of the script pipes stderr to another command and that command exits.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities