Shells in OCaml
1More fine-grained testing of the possible shell execution options.
2
3First, we test the noglob option.
4
5 $ cat > test.sh << EOF
6 > set -f
7 > touch a.txt b.txt
8 > ls *.txt
9 > EOF
10
11 $ sh test.sh
12 ls: cannot access '*.txt': No such file or directory
13 [2]
14 $ msh test.sh
15 ls: cannot access '*.txt': No such file or directory
16 [2]
17
18No unset variable option.
19
20 $ cat > test.sh << EOF
21 > echo "The variable is: \$UNSETVAR"
22 > set -u
23 > echo \$UNSETVAR
24 > EOF
25
26 $ sh test.sh
27 The variable is:
28 test.sh: line 3: UNSETVAR: unbound variable
29 [1]
30 $ msh test.sh
31 The variable is:
32 UNSETVAR: unbound variable
33 [1]