DEV Community

Discussion on: What is the Coolest Program ever?

Collapse
 
thomasjunkos profile image
Thomas Junkツ

The coolest algorithm is IMHO sleepsort

#!/bin/bash


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
Collapse
 
o2sh profile image
o2sh • Edited

Yep, it's pretty nice.
It was one of my first post on codl.dev

Post N°21