Skip to content

Instantly share code, notes, and snippets.

@milon
Last active November 7, 2019 16:41
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 milon/b3b529c88a954216a6fcf30df1ea42fc to your computer and use it in GitHub Desktop.
Save milon/b3b529c88a954216a6fcf30df1ea42fc to your computer and use it in GitHub Desktop.
sorting based on sleep time
#!/bin/bash
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1" ]
do
f "$1" &
shift
done
wait
# example use
# ./sleepsort.sh 3 4 2 7 6 1 8 5 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment