###### # Color Profile V2.20 (for FreeBSD, OpenBSD, NetBSD, Linux, Darwin) # Author: Jimmy Scott # Nick: Sick` # Mail: jimmy *at* inet-solutions.be # Address: Jimmy Scott # Goordijk 66 # 2930 BRASSCHAAT # BELGIUM # source: http://pub.devbox.be # $DevBox: bash_profile.txt,v 1.2 2004/08/25 19:24:56 jimmy Exp $ ### # # DEPENDS: # FreeBSD: gnuls, bash packages or none # NetBSD: colorls package or linuxls package # OpenBSD: gnuls, bash packages # Linux: go figure, should work on almost every GNU/Linux distro # Darwin: ColorLS package or none for Darwin 7.*.* and higher # ### # # DO NOT REPLACE AS /etc/profile UNLESS NOBODY IS GOING TO USE CSH/TCSH/SH # ### # # Copyright (C) 2003 Jimmy Scott # # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # 3. The names of the authors may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. # ###### ###### # USER DEFINED VARS, PLEASE CONFIGURE ! ### # uncomment and change this if you are behind a proxy server #HTTP_PROXY="proxy.domain.tld:8080"; export HTTP_PROXY #FTP_PROXY=""; export FTP_PROXY # uncomment to set nano or another one as default editor #EDITOR="nano"; export EDITOR # uncomment to change the path to something more usefull #OLDPATH="$PATH" #PATH="/sbin:/bin:/usr/sbin:/usr/bin" #PATH="$PATH:/usr/local/sbin:/usr/local/bin" #PATH="$PATH:/opt/sbin:/opt/bin" #PATH="$PATH:/usr/pkg/sbin:/usr/pkg/bin" #PATH="$PATH:/usr/games" #PATH="$PATH:/usr/X11R6/bin" #PATH="$PATH:$HOME/bin" #export OLDPATH #export PATH # uncomment or/and edit for safer file creation #umask 077 # uncomment for no .bash_history #NOHIST=1 # uncomment to disable bold colors as much as posible #NOBOLD=1 # change terminal for trying to force colors #TERM="cons25" # for BSD's ls in console #TERM="vt100" # for GNU's ls in console #TERM="xterm-color" # for 'xterm' #export TERM # uncomment to just force those colors from GNU's ls ffs #CFORCE=1 # uncomment to have no colors in the prompt #NOPROMTC=1 # use ssh as default cvs method CVS_RSH="ssh"; export CVS_RSH ###### # Code goes below, configuration stops here ! # Aliases can be added at end of file ### UNAME=`uname` ###### # setting and checking hist if desired ### if [[ "$NOHIST" ]]; then if [[ -f $HISTFILE ]]; then echo "WARN: $HISTFILE still exists" fi HISTFILE="/dev/null"; export HISTFILE fi ###### # try setting directory colors ### if [[ "$UNAME" == "FreeBSD" ]]; then if [[ -f /usr/local/bin/gnuls ]]; then if [[ "$CFORCE" ]]; then eval `env TERM="vt100" dircolors -b 2> /dev/null` else eval `dircolors -b 2> /dev/null` fi alias ls="gnuls --color=auto" else alias ls="ls -G" fi fi if [[ "$UNAME" == "Linux" ]]; then if [[ "$CFORCE" ]]; then eval `env TERM="vt100" dircolors -b 2> /dev/null` else eval `dircolors -b 2> /dev/null` fi alias ls="ls --color=auto" fi if [[ -f /usr/local/bin/gls && "$UNAME" == "OpenBSD" ]]; then if [[ "$CFORCE" ]]; then eval `env TERM="vt100" dircolors -b 2> /dev/null` else eval `dircolors -b 2> /dev/null` fi alias ls="gls --color=auto" fi if [[ -f /usr/pkg/bin/colorls && "$UNAME" == "NetBSD" ]]; then alias ls="colorls -G" else if [[ -f /usr/pkg/bin/linuxls && "$UNAME" == "NetBSD" ]]; then if [[ "$CFORCE" ]]; then eval `env TERM="vt100" dircolors -b ~ 2> /dev/null` else eval `dircolors -b ~ 2> /dev/null` fi alias ls="linuxls --color=tty" fi fi if [[ "$UNAME" == "Darwin" ]]; then if [[ -f /bin/cls ]]; then alias ls="cls --color=auto" else if [[ `uname -r | awk -F '.' '{print $1}'` -ge "7" ]]; then if [[ "$CFORCE" && "$TERM" == "vt100" ]]; then TERM="cons25"; export TERM fi if [[ "$CFORCE" && "$TERM" == "xterm" ]]; then TERM="xterm-color"; export TERM fi alias ls="ls -G" fi fi fi ###### # remove bold from lscolors ### if [[ "$NOBOLD" && "$LS_COLORS" ]]; then LS_COLORS=`echo $LS_COLORS | sed s/"=01;"/"=00;"/g` export LS_COLORS fi ###### # some aliases ### alias pslist="ps -arxo user,pid,%cpu,%mem,stat,command" alias crkill="perl -pi -le 's/\r//;'" # removes all cariage returns in a file alias crbkill="perl -pi.bak -le 's/\r//;'" if [[ "$UNAME" == "FreeBSD" ]]; then alias poweroff="shutdown -p now" fi if [[ "$UNAME" == "Linux" ]]; then alias poweroff="shutdown -h now" fi if [[ "$UNAME" == "OpenBSD" || "$UNAME" == "NetBSD" ]]; then alias poweroff="shutdown -hp now" fi if [[ "$UNAME" == "Darwin" ]]; then alias poweroff="poweroff-compat" poweroff-compat() { if [[ "$1" == "-yes" ]]; then shutdown -h now else echo "Use 'shutdown -yes' if you really mean it, " \ "if you are using OS X this can damage " \ "your files or your entire home folder !!!" fi } fi ###### # building bash colors ### C00="\[\033[0m\]" # default color or grey C01="\[\033[0;30m\]" # black C02="\[\033[1;30m\]" # dark grey (bold) C03="\[\033[0;31m\]" # dark red C04="\[\033[1;31m\]" # red (bold) C05="\[\033[0;32m\]" # dark green C06="\[\033[1;32m\]" # green (bold) C07="\[\033[0;33m\]" # gold yellow C08="\[\033[1;33m\]" # yellow (bold) C09="\[\033[0;34m\]" # dark blue C10="\[\033[1;34m\]" # blue (bold) C11="\[\033[0;35m\]" # dark purple C12="\[\033[1;35m\]" # purple (bold) C13="\[\033[0;36m\]" # dark seagrean C14="\[\033[1;36m\]" # seagreen (bold) C15="\[\033[0;37m\]" # grey or regular white C16="\[\033[1;37m\]" # white (bold) if [[ "$NOBOLD" ]]; then C02="\[\033[0;30m\]" C04="\[\033[0;31m\]" C06="\[\033[0;32m\]" C08="\[\033[0;33m\]" C10="\[\033[0;34m\]" C12="\[\033[0;35m\]" C14="\[\033[0;36m\]" C16="\[\033[0;37m\]" fi ###### # building the prompts ### if [[ "$NOPROMPTC" ]]; then if [[ "`id -u`" -eq 0 ]]; then PS1="[\u@\h:\w]# " else PS1="[\u@\h:\w]\$ " fi PS2="> " else if [[ "`id -u`" -eq 0 ]]; then PS1="${C04}[${C10}\u${C13}@${C10}\h${C13}:${C10}\w${C04}]${C13}#${C00} " else PS1="${C04}[${C10}\u${C13}@${C10}\h${C13}:${C10}\w${C04}]${C13}\$${C00} " fi PS2="${C05}>${C00} " fi export PS1 PS2 ###### # debug testing colors, uncomment to use the debugging feature 'viewcolors' ### #DBUG=1 if [[ "$DBUG" ]]; then viewcolors() { echo -e "${C00}C00 = \ ${C00}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C01 = \ ${C01}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C02 = \ ${C02}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C03 = \ ${C03}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C04 = \ ${C04}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C05 = \ ${C05}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C06 = \ ${C06}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C07 = \ ${C07}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C08 = \ ${C08}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C09 = \ ${C09}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C10 = \ ${C10}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C11 = \ ${C11}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C12 = \ ${C12}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C13 = \ ${C13}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C14 = \ ${C14}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C15 = \ ${C15}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g echo -e "${C00}C16 = \ ${C16}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"\ | sed s/'\\\]'//g | sed s/'\\\['//g } fi