Conditional execution Bash (Unix shell)
where ./do_something executed if cd (change directory) command successful (returned exit status of zero) , echo command executed if either cd or ./do_something command return error (non-zero exit status).
for commands exit status stored in special variable $?. bash supports if ...;then ...;else ...;fi , case $variable in $pattern)...;;$other_pattern)...;; esac forms of conditional command evaluation.
Comments
Post a Comment