Skip to content

Instantly share code, notes, and snippets.

@mralext20
Last active February 3, 2017 21:45
Show Gist options
  • Save mralext20/190069a6ce84ffac13ace6a4d24d07a0 to your computer and use it in GitHub Desktop.
Save mralext20/190069a6ce84ffac13ace6a4d24d07a0 to your computer and use it in GitHub Desktop.
#/bin/sh
text=${1,,} #lowercase the string
for i in $(seq 1 ${#1}) #first loop, prints the regional indicators
do
if [ "${text:i-1:1}" = " " ]
then
echo -n " "
else if [ "${text:i-1:1}" = "-" ]
then
echo -n ":heavy_minus_sign: "
else
echo -n ":regional_indicator_${text:i-1:1}: "
fi
fi
done
echo "" #print a second, new line
for i in $(seq 1 ${#1}) #second loop, prints :ok_woman::skin-tone-1:
do
if [ "${text:i-1:1}" = " " ]
then
echo -n " "
else
echo -n ":ok_woman::skin-tone-$((1 + RANDOM % 5)): "
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment