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.

Required fields*

3
  • 3
    You got the first case wrong, it's if command; then echo successful; fi, and if ! command; then echo unsuccessful; fi. The condition for if when checking exit codes is reversed. Commented Jun 11, 2015 at 4:17
  • 1
    0 is when program exits successfully. Non zero is errors or failures. adding ! helped, thanks @lcd047 for suggesting. Commented Jun 11, 2015 at 5:21
  • @lcd047 Right, I forgot the !. Thanks for noticing. Commented Jun 11, 2015 at 12:22