1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # expr returns 1 if expression is null or 0
20 N_MOD_100=`expr $N % 100`
24 if [ $N -eq 110 ]; then
45 # command subst should not inherit -e
47 echo $(false; echo ok)
57 # a failing command in the compound list following a while, until, or
58 # if should not cause the shell to exit
66 until (( x == 4 )); do
69 echo until succeeded: $x
76 # failing commands that are part of an AND or OR list should not
77 # cause the shell to exit
78 false && echo AND list failed
79 echo AND list succeeded
81 false || echo OR list succeeded
86 # make sure eval preserves the state of the -e flag and `!' reserved word
94 echo ! eval succeeded -- 1
97 echo ! eval succeeded -- 2
100 until builtin false; do echo a; break; done
103 until eval false; do echo b; break; done
115 until . $FN; do echo a; break; done
122 ${THIS_SH} ./set-e1.sub
123 ${THIS_SH} ./set-e2.sub
124 ${THIS_SH} ./set-e3.sub