Skip to content

Instantly share code, notes, and snippets.

@kuoe0
Last active September 11, 2018 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kuoe0/7228839 to your computer and use it in GitHub Desktop.
Save kuoe0/7228839 to your computer and use it in GitHub Desktop.
generate all combination of control code
#!/bin/bash
TEXT=" text "
RESET="\x1b[0m"
echo -n ' '
for i in `seq 0 7`; do
echo -n " 4${i}m "
done
echo
for S in `seq 0 8`; do
if [ $S = '3' ] || [ $S = '6' ]; then
continue
fi
for F in `seq 30 37`; do
CODE=`echo "${S};${F};m"`
echo -n " $CODE"
echo -ne " \x1b[${CODE}${TEXT}${RESET}"
for B in `seq 40 47`; do
CODE=`echo "${S};${F};${B}m"`
echo -ne " \x1b[${CODE}${TEXT}${RESET}"
done
echo
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment