Skip to content

Instantly share code, notes, and snippets.

@jmarcher
Last active August 8, 2022 12:32
Show Gist options
  • Save jmarcher/0f7534b50edaaa8339ac591e13a77b68 to your computer and use it in GitHub Desktop.
Save jmarcher/0f7534b50edaaa8339ac591e13a77b68 to your computer and use it in GitHub Desktop.
#!/bin/bash
function divider() {
local _d=${3:-2}
local _n=0000000000
_n=${_n:0:$_d}
local _r=$(($1$_n/$2))
_r=${_r:0:-$_d}.${_r: -$_d}
echo $_r
}
function sort() {
sleep "$2"
echo "$1"
}
while [ -n "$1" ]
do
if [ "0" -gt "$1" ]; then
sort $1 "$(divider 1 $(($1 * -1)) 2)" &
else
sort $1 $(($1 +1)) &
fi
shift
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment