Skip to content

Instantly share code, notes, and snippets.

@Resisty
Created February 28, 2020 22:13
Show Gist options
  • Save Resisty/6a70ac5d336d5babe456f0ac924bb04c to your computer and use it in GitHub Desktop.
Save Resisty/6a70ac5d336d5babe456f0ac924bb04c to your computer and use it in GitHub Desktop.
Awful Bash String Reverse
#!/usr/bin/env bash
# This was done as a joke at work when we were talking about interview questions.
# I am unashamed.
string="$1"
for (( i=0; i<${#string}; i++ ));
do
{ eval "sleep \$(expr \${#string} - \$i) && printf '%s' '${string:$i:1}'" & } 2>/dev/null
done
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment