Skip to content

Instantly share code, notes, and snippets.

@dualbus
Created March 7, 2014 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dualbus/9419809 to your computer and use it in GitHub Desktop.
Save dualbus/9419809 to your computer and use it in GitHub Desktop.
11 bash: 2
8 dash: 0
3 dash: 3
10 jsh: 0
1 jsh: 3
11 ksh: 3
11 mksh: 0
11 zsh: 2
code='trap "(exit 2); return" USR1
f() {
while :; do
(exit 3) > "$fifo"
sleep 0.5
done
return 5
}
{ read x < "$fifo"; kill -USR1 $$; } & (exit 7); f; echo $?
'
trap 'rm -f "$fifo"' EXIT
fifo=$(mktemp); rm -f "$fifo"; mkfifo "$fifo"; export fifo
shells=(
bash
ksh
mksh
dash
# 'busybox sh'
jsh
zsh
)
for attempt in {0..10}; do
time for shell in "${shells[@]}"; do
printf '%s: %s\n' "$shell" "$($shell -c "$code")"
done
done | sort | uniq -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment