Difference between revisions of "Terminal notes"

From Noah.org
Jump to navigationJump to search
(New page: == colors.sh == This tests colors. I forget where I found this... <pre> #!/bin/bash echo echo "Table for 16-color terminal escape sequences." echo "color table of 8bg * 8fg * 2 states...)
 
 
Line 1: Line 1:
 
+
[[Category:Engineering]]
 
 
 
== colors.sh ==
 
== colors.sh ==
  

Latest revision as of 21:56, 28 January 2009

colors.sh

This tests colors. I forget where I found this...

#!/bin/bash

echo
echo "Table for 16-color terminal escape sequences."
echo "color table of 8bg * 8fg * 2 states (regular/bold)"
echo
echo "Replace ESC with \\033 in bash."
echo
echo "Background | Foreground colors"
echo "---------------------------------------------------------------------"
for((bg=40;bg<=47;bg++)); do
    for((bold=0;bold<=1;bold++)) do
        echo -en "\033[0m"" ESC[${bg}m   | "
        for((fg=30;fg<=37;fg++)); do
            if [ $bold == "0" ]; then
                echo -en "\033[${bg}m\033[${fg}m [${fg}m  "
            else
                echo -en "\033[${bg}m\033[1;${fg}m [1;${fg}m"
            fi
        done
        echo -e "\033[0m"
    done
    echo "--------------------------------------------------------------------- "
done
echo