Last active
February 3, 2017 21:45
-
-
Save mralext20/190069a6ce84ffac13ace6a4d24d07a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/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