Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • While this works for three possible control flows (0, 1, and other), it is not extensible — try adding an elif [ $? -eq 2 ]; then branch — and it papers over a flaw in the OP’s code. Commented Feb 29, 2020 at 2:02
  • @G-ManSays'ReinstateMonica' If I can trust my memory, I was purposely trying to keep my answer simple (in line with that the OP's level of knowledge and what they were looking for). Rather than edit my answer to make it more general, I'll just upvote yours! Commented Feb 29, 2020 at 17:52