From 6a4b6fdaa0f03176905a59dae15af47b17c5f634 Mon Sep 17 00:00:00 2001 From: Ian Foster Date: Tue, 28 Jan 2014 18:02:54 -0800 Subject: [PATCH] created new colors script to show bash color escape codes --- scripts/colors.sh | 33 +++++++++++++++++++++++++++++++++ shell/bashrc | 34 ++++++++++++++++++++++++++++++++++ shell/profile | 34 ---------------------------------- 3 files changed, 67 insertions(+), 34 deletions(-) create mode 100755 scripts/colors.sh create mode 100644 shell/bashrc delete mode 100644 shell/profile diff --git a/scripts/colors.sh b/scripts/colors.sh new file mode 100755 index 0000000..ed457d5 --- /dev/null +++ b/scripts/colors.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + + +colors() { + local fgc bgc vals seq0 + + printf "Color escapes are %s\n" '\e[${value};...;${value}m' + printf "Values 30..37 are \e[33mforeground colors\e[m\n" + printf "Values 40..47 are \e[43mbackground colors\e[m\n" + printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n" + + # foreground colors + for fgc in {30..37}; do + # background colors + for bgc in {40..47}; do + fgc=${fgc#37} # white + bgc=${bgc#40} # black + + vals="${fgc:+$fgc;}${bgc}" + vals=${vals%%;} + + seq0="${vals:+\e[${vals}m}" + printf " %-9s" "${seq0:-(default)}" + printf " ${seq0}TEXT\e[m" + printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m" + done + echo; echo + done +} + + +colors + diff --git a/shell/bashrc b/shell/bashrc new file mode 100644 index 0000000..c7a4e34 --- /dev/null +++ b/shell/bashrc @@ -0,0 +1,34 @@ +# ~/.profile: executed by the command interpreter for login shells. +# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login +# exists. +# see /usr/share/doc/bash/examples/startup-files for examples. +# the files are located in the bash-doc package. + +# the default umask is set in /etc/profile; for setting the umask +# for ssh logins, install and configure the libpam-umask package. +#umask 022 + +# if running bash +if [ -n "$BASH_VERSION" ]; then + # include .bashrc if it exists + if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" + fi +fi + +# include sbin in PATH +if [ -d "/sbin" ] ; then + PATH="/sbin:$PATH" +fi +if [ -d "/usr/sbin" ] ; then + PATH="/usr/sbin:$PATH" +fi +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" +fi + +alias untar="tar -xf" + +#tell google chrome to use ram for cache +export CHROMIUM_USER_FLAGS="--disk-cache-dir=/tmp" diff --git a/shell/profile b/shell/profile deleted file mode 100644 index c7a4e34..0000000 --- a/shell/profile +++ /dev/null @@ -1,34 +0,0 @@ -# ~/.profile: executed by the command interpreter for login shells. -# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login -# exists. -# see /usr/share/doc/bash/examples/startup-files for examples. -# the files are located in the bash-doc package. - -# the default umask is set in /etc/profile; for setting the umask -# for ssh logins, install and configure the libpam-umask package. -#umask 022 - -# if running bash -if [ -n "$BASH_VERSION" ]; then - # include .bashrc if it exists - if [ -f "$HOME/.bashrc" ]; then - . "$HOME/.bashrc" - fi -fi - -# include sbin in PATH -if [ -d "/sbin" ] ; then - PATH="/sbin:$PATH" -fi -if [ -d "/usr/sbin" ] ; then - PATH="/usr/sbin:$PATH" -fi -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/bin" ] ; then - PATH="$HOME/bin:$PATH" -fi - -alias untar="tar -xf" - -#tell google chrome to use ram for cache -export CHROMIUM_USER_FLAGS="--disk-cache-dir=/tmp" -- 1.9.1