summaryrefslogtreecommitdiffhomepage
path: root/tests/posix/execfail.sh
blob: f598fd3197f2582b0178af7cad06c7fa3dbd0912 (plain)
1
2
3
4
5
6
7
8
# How a command that cannot be executed is reported, and script fallback.
/nonexistent/cmd 2>/dev/null; echo $?
nonexistent_cmd_xyz 2>/dev/null; echo $?
touch noexec; ./noexec 2>/dev/null; echo $?
printf '#!/bin/sh\necho shebang $1\n' >s1; chmod +x s1; ./s1 arg
printf 'echo no-shebang $1\n' >s2; chmod +x s2; ./s2 arg
mkdir bin; printf '#!/bin/sh\necho from-path\n' >bin/mycmd; chmod +x bin/mycmd; PATH=$PWD/bin:$PATH; mycmd
PATH=/nonexistent mycmd 2>/dev/null; echo "path-prefix $?"