?? set-e.tests
字號(hào):
if : ; then set -e N=95 while :; do # expr returns 1 if expression is null or 0 set +e N_MOD_100=`expr $N % 100` set -e echo $N_MOD_100 N=`expr $N + 1` if [ $N -eq 110 ]; then break fi done set +efi(set -efalseecho bad)echo $?x=$(set -efalseecho bad)echo $? $x# command subst should not inherit -eset -eecho $(false; echo ok)if set +ethen falsefiecho hiset -e# a failing command in the compound list following a while, until, or# if should not cause the shell to exitwhile false; do echo hidoneecho while succeededx=1until (( x == 4 )); do x=4doneecho until succeeded: $xif false; then echo oopsfiecho if succeeded# failing commands that are part of an AND or OR list should not# cause the shell to exitfalse && echo AND list failedecho AND list succeededfalse || echo OR list succeeded! falseecho ! succeeded# make sure eval preserves the state of the -e flag and `!' reserved wordset -eif eval false; then echo oopsfiecho eval succeeded! eval falseecho ! eval succeeded -- 1! eval '(exit 5)'echo ! eval succeeded -- 2set -euntil builtin false; do echo a; break; doneecho $?until eval false; do echo b; break; doneecho $?: ${TMPDIR:=/tmp}FN=$TMPDIR/set-e-$$cat > $FN << EOFfalseecho after 1falseEOFset -euntil . $FN; do echo a; break; doneecho $?rm -f $FNset +e${THIS_SH} ./set-e1.sub${THIS_SH} ./set-e2.sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -