Skip to content

Instantly share code, notes, and snippets.

@jlouis
Forked from timendum/sleepsort.bash
Created May 23, 2017 22:19
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 jlouis/e4b84e6e58cd0cc248cfda184b73cd45 to your computer and use it in GitHub Desktop.
Save jlouis/e4b84e6e58cd0cc248cfda184b73cd45 to your computer and use it in GitHub Desktop.
Sleep sort!
#!/bin/bash
# Sleep sort
# http://dis.4chan.org/read/prog/1295544154
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1" ]
do
f "$1" &
shift
done
wait
# example usage:
# ./sleepsort.bash 5 3 6 3 6 3 1 4 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment