Skip to content

Instantly share code, notes, and snippets.

@dualbus
Created May 25, 2014 19:52
Show Gist options
  • Save dualbus/31dee9ce487ba64413a5 to your computer and use it in GitHub Desktop.
Save dualbus/31dee9ce487ba64413a5 to your computer and use it in GitHub Desktop.
#!/bin/bash
for shell in zsh ksh mksh dash bash /bin/bash 'busybox sh'; do
echo "$shell":
$shell <<'eof'
set -x
PATH=
echo "PATH=$PATH"
ls
eof
$shell <<'eof'
set -x
PATH=
path=/bin
echo "PATH=$PATH"
ls
eof
echo
done
zsh:
+zsh:2> PATH=''
+zsh:3> echo 'PATH='
PATH=
+zsh:4> ls
zsh: command not found: ls
+zsh:2> PATH=''
+zsh:3> path=/bin
+zsh:4> echo 'PATH=/bin'
PATH=/bin
+zsh:5> ls
funnyzsh
output
test
xyz
ksh:
+ PATH=''
+ echo PATH=
PATH=
+ ls
ksh[4]: ls: not found [No such file or directory]
+ PATH=''
+ path=/bin
+ echo PATH=
PATH=
+ ls
ksh[5]: ls: not found [No such file or directory]
mksh:
+ PATH=
+ echo PATH=
PATH=
+ ls
mksh: <stdin>[4]: ls: not found
+ PATH=
+ path=/bin
+ echo PATH=
PATH=
+ ls
mksh: <stdin>[5]: ls: not found
dash:
+ PATH=
+ echo PATH=
PATH=
+ ls
dash: 4: ls: not found
+ PATH=
+ path=/bin
+ echo PATH=
PATH=
+ ls
dash: 5: ls: not found
bash:
+ PATH=
+ echo PATH=
PATH=
+ ls
bash: line 4: ls: No such file or directory
+ PATH=
+ path=/bin
+ echo PATH=
PATH=
+ ls
bash: line 5: ls: No such file or directory
/bin/bash:
+ PATH=
+ echo PATH=
PATH=
+ ls
/bin/bash: line 4: ls: No such file or directory
+ PATH=
+ path=/bin
+ echo PATH=
PATH=
+ ls
/bin/bash: line 5: ls: No such file or directory
busybox sh:
+ PATH=
+ echo PATH=
PATH=
+ ls
funnyzsh
output
test
xyz
+ PATH=
+ path=/bin
+ echo PATH=
PATH=
+ ls
funnyzsh
output
test
xyz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment