2 ms·
Instead of somecommand if [ $? -ne 0 ]; then echo "it failed"; fi the parent commenter presumably wants to see if ! somecommand; then echo "it failed"; fi
by schoen 12y ago
Instead of
somecommand
if [ $? -ne 0 ]; then echo "it failed"; fi
the parent commenter presumably wants to see
if ! somecommand; then echo "it failed"; fi
- viraptor 12y agoOr: somecommand || echo "it failed" if it's just one statement. There are some cases where it just looks more natural. For example: start_service || log "already started"