mijies - 2018-10-27

It just returns exit code 0 when the interpreter finds syntax errors.
So the following example has "set -e", but the script does not stop.

I am afraid that unit-tests could not find the bug depending on how they are written.
(Actually this happened in a production environment, an app calls the script)

# cat ./foo.sh
#!/bin/bash

set -e

expect -c "
spawn \"wrong syntax\"
"
echo $?
# ./foo.sh
spawn wrong syntax
couldn't execute "wrong syntax": no such file or directory
    while executing
"spawn "wrong syntax""
0
 

Last edit: mijies 2018-10-27