1 #!/usr/bin/env bash
2 #
3 # Miscellaneous tests for the command language.
4
5 #### Command block
6 { which ls; }
7 ## stdout: /bin/ls
8
9 #### Permission denied
10 touch $TMP/text-file
11 $TMP/text-file
12 ## status: 126
13
14 #### Not a dir
15 $TMP/not-a-dir/text-file
16 ## status: 127
17
18 #### Name too long
19 ./0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
20 ## status: 127
21 ## OK dash status: 2
22 ## OK bash status: 126
23
24 #### External programs don't have _OVM in environment
25 # bug fix for leakage
26 env | grep _OVM
27 echo status=$?
28 ## stdout: status=1
29
30 #### File with no shebang is executed
31 # most shells execute /bin/sh; bash may execute itself
32 echo 'echo hi' > $TMP/no-shebang
33 chmod +x $TMP/no-shebang
34 $SH -c '$TMP/no-shebang'
35 ## stdout: hi
36 ## status: 0