Commit 6a4b6fdaa0f03176905a59dae15af47b17c5f634
1 parent
d0fb01ce81
Exists in
master
created new colors script to show bash color escape codes
Showing 3 changed files with 67 additions and 34 deletions Side-by-side Diff
scripts/colors.sh
View file @
6a4b6fd
1 | +#!/usr/bin/env bash | |
2 | + | |
3 | + | |
4 | +colors() { | |
5 | + local fgc bgc vals seq0 | |
6 | + | |
7 | + printf "Color escapes are %s\n" '\e[${value};...;${value}m' | |
8 | + printf "Values 30..37 are \e[33mforeground colors\e[m\n" | |
9 | + printf "Values 40..47 are \e[43mbackground colors\e[m\n" | |
10 | + printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n" | |
11 | + | |
12 | + # foreground colors | |
13 | + for fgc in {30..37}; do | |
14 | + # background colors | |
15 | + for bgc in {40..47}; do | |
16 | + fgc=${fgc#37} # white | |
17 | + bgc=${bgc#40} # black | |
18 | + | |
19 | + vals="${fgc:+$fgc;}${bgc}" | |
20 | + vals=${vals%%;} | |
21 | + | |
22 | + seq0="${vals:+\e[${vals}m}" | |
23 | + printf " %-9s" "${seq0:-(default)}" | |
24 | + printf " ${seq0}TEXT\e[m" | |
25 | + printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m" | |
26 | + done | |
27 | + echo; echo | |
28 | + done | |
29 | +} | |
30 | + | |
31 | + | |
32 | +colors |
shell/bashrc
View file @
6a4b6fd
1 | +# ~/.profile: executed by the command interpreter for login shells. | |
2 | +# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login | |
3 | +# exists. | |
4 | +# see /usr/share/doc/bash/examples/startup-files for examples. | |
5 | +# the files are located in the bash-doc package. | |
6 | + | |
7 | +# the default umask is set in /etc/profile; for setting the umask | |
8 | +# for ssh logins, install and configure the libpam-umask package. | |
9 | +#umask 022 | |
10 | + | |
11 | +# if running bash | |
12 | +if [ -n "$BASH_VERSION" ]; then | |
13 | + # include .bashrc if it exists | |
14 | + if [ -f "$HOME/.bashrc" ]; then | |
15 | + . "$HOME/.bashrc" | |
16 | + fi | |
17 | +fi | |
18 | + | |
19 | +# include sbin in PATH | |
20 | +if [ -d "/sbin" ] ; then | |
21 | + PATH="/sbin:$PATH" | |
22 | +fi | |
23 | +if [ -d "/usr/sbin" ] ; then | |
24 | + PATH="/usr/sbin:$PATH" | |
25 | +fi | |
26 | +# set PATH so it includes user's private bin if it exists | |
27 | +if [ -d "$HOME/bin" ] ; then | |
28 | + PATH="$HOME/bin:$PATH" | |
29 | +fi | |
30 | + | |
31 | +alias untar="tar -xf" | |
32 | + | |
33 | +#tell google chrome to use ram for cache | |
34 | +export CHROMIUM_USER_FLAGS="--disk-cache-dir=/tmp" |
shell/profile
View file @
6a4b6fd
1 | -# ~/.profile: executed by the command interpreter for login shells. | |
2 | -# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login | |
3 | -# exists. | |
4 | -# see /usr/share/doc/bash/examples/startup-files for examples. | |
5 | -# the files are located in the bash-doc package. | |
6 | - | |
7 | -# the default umask is set in /etc/profile; for setting the umask | |
8 | -# for ssh logins, install and configure the libpam-umask package. | |
9 | -#umask 022 | |
10 | - | |
11 | -# if running bash | |
12 | -if [ -n "$BASH_VERSION" ]; then | |
13 | - # include .bashrc if it exists | |
14 | - if [ -f "$HOME/.bashrc" ]; then | |
15 | - . "$HOME/.bashrc" | |
16 | - fi | |
17 | -fi | |
18 | - | |
19 | -# include sbin in PATH | |
20 | -if [ -d "/sbin" ] ; then | |
21 | - PATH="/sbin:$PATH" | |
22 | -fi | |
23 | -if [ -d "/usr/sbin" ] ; then | |
24 | - PATH="/usr/sbin:$PATH" | |
25 | -fi | |
26 | -# set PATH so it includes user's private bin if it exists | |
27 | -if [ -d "$HOME/bin" ] ; then | |
28 | - PATH="$HOME/bin:$PATH" | |
29 | -fi | |
30 | - | |
31 | -alias untar="tar -xf" | |
32 | - | |
33 | -#tell google chrome to use ram for cache | |
34 | -export CHROMIUM_USER_FLAGS="--disk-cache-dir=/tmp" |