Bash if: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 23: | Line 23: | ||
<pre> | <pre> | ||
function my-test() { | function my-test() { | ||
return 0 | |||
#return 1 | |||
} | } | ||
Revision as of 23:42, 4 September 2016
Internal
Overview
if <command-that-returns-0-or-non-0>; then # # execute this is the command returned 0 # else # # execute this is the command returned non-0 # fi
Example:
function my-test() { return 0 #return 1 } if my-test; then echo "my-test() returned 0" else echo "my-test() returned non-0" fi