# ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples eval `/opt/local/bin/lesspipe.sh` function dir_access_color { local DIR="${1-$PWD}" COLOR=0 [[ -r "$DIR" ]] && COLOR=1 # red [[ -w "$DIR" ]] && COLOR=2 # green tput -S <<<$'bold\nsetaf '"$COLOR" } function nfmxtermtitle { local HOST="$(cut -d. -f1 <<< "$HOSTNAME")" local DIR="$(dirs +0)" DIR="${DIR%/}/" # gnome-terminal doesn't mind, but xterm refuses to set the title if # it contains non-ASCII characters. So, use x instead of ×. local TITLE="${XTTITLE-${USER}@${HOST}}: ${DIR} [$$] ${COLUMNS}x${LINES}" local ICON="${XTTITLE-$USER}: ${DIR}" } # If running interactively, then: if [ "$PS1" ]; then # Use 256 colors in xterm and gnome-terminal case "$(ps h -o comm "$PPID")" in gnome-terminal) TERM=gnome-256color ;; xterm) TERM=xterm-256color esac # don't put duplicate lines in the history. See bash(1) for more options export HISTCONTROL=ignoredups # enable color support of ls and also add handy aliases alias ls='ls -G' # set a fancy prompt PS1=$(for ((i=1;i