Created
March 7, 2014 20:50
-
-
Save dualbus/9419809 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 bash: 2 | |
8 dash: 0 | |
3 dash: 3 | |
10 jsh: 0 | |
1 jsh: 3 | |
11 ksh: 3 | |
11 mksh: 0 | |
11 zsh: 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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