At Thu, 31 Jan 2019 10:37:28 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi.kyot...@lab.ntt.co.jp> wrote in <20190131.103728.153290385.horiguchi.kyot...@lab.ntt.co.jp> > > I think ON_ERROR_STOP would control whether the script stops, but it should > > fail the exit status should reflect any error in the last command. The > > shell > > does that even without set -e. > > At least bash behaves exactly the same way to psql for me. (Just > so there's not confusion, set -e works opposite as you think. I > always use explcit exit to do that, though). > > ===t.sh: > hoge > hage > echo Ho-Ho-Ho > === > $ bash t.sh ; echo $? > test.sh: line 1: hoge: command not found > test.sh: line 2: hage: command not found > Ho-Ho-Ho > 0 > > ===t.sh: > set -e > hoge > hage > echo Ho-Ho-Ho > === > $ bash t.sh ; echo $? > test.sh: line 2: hage: command not found > 127
Sorry, that was not so good as an example. === t.sh set -e ls -impossible echo HoHoHoHo === $ bash ~/test.sh; echo $? ls: invalid option -- 'e' Try 'ls --help' for more information. 2 === without set -e $ bash ~/test.sh; echo $? ls: invalid option -- 'e' Try 'ls --help' for more information. HoHoHoHo 0 # Wow. ls -impossibl works! regards. -- Kyotaro Horiguchi NTT Open Source Software Center