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 Inline Diff
scripts/colors.sh
View file @
6a4b6fd
File was created | 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" |
shell/bashrc
View file @
6a4b6fd
File was created | 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 |
shell/profile
View file @
6a4b6fd
# ~/.profile: executed by the command interpreter for login shells. | 1 | File was deleted | ||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login | 2 | |||
# exists. | 3 | |||
# see /usr/share/doc/bash/examples/startup-files for examples. | 4 | |||
# the files are located in the bash-doc package. | 5 | |||
6 | ||||
# the default umask is set in /etc/profile; for setting the umask | 7 | |||
# for ssh logins, install and configure the libpam-umask package. | 8 | |||
#umask 022 | 9 | |||
10 | ||||
# if running bash | 11 | |||
if [ -n "$BASH_VERSION" ]; then | 12 | |||
# include .bashrc if it exists | 13 | |||
if [ -f "$HOME/.bashrc" ]; then | 14 | |||
. "$HOME/.bashrc" | 15 | |||
fi | 16 | |||
fi | 17 | |||
18 | ||||
# include sbin in PATH | 19 | |||
if [ -d "/sbin" ] ; then | 20 | |||
PATH="/sbin:$PATH" | 21 | |||
fi | 22 | |||
if [ -d "/usr/sbin" ] ; then | 23 | |||
PATH="/usr/sbin:$PATH" | 24 | |||
fi | 25 | |||
# set PATH so it includes user's private bin if it exists | 26 | |||
if [ -d "$HOME/bin" ] ; then | 27 | |||
PATH="$HOME/bin:$PATH" | 28 | |||
fi | 29 |