!
論理否定
コマンドの前に
! command
とビックリマークを入れると、終了ステータスに論理否定(logical NOT)が適用される。つまり終了ステータスの0が1となり、0以外が1となる。
これにより、
if
文で、以下のように書くことができる。
code:notsample.sh
if ! command ; then
# command がエラーになった時の処理
fi
POSIX sh での定義
Pipelines
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_02
keyword
not,反転