# Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # Turn on extended pattern matching: shopt -s extglob # Turns off '!' history expansion: set +H # Useful aliases: alias big='figlet -tcW' alias ..='cd ..' alias cd..='cd ..' alias cls=clear alias cr='chmod a+r' alias cx='chmod a+x' alias df='df -h' alias doh="play -q ~/sounds/Doh1.au" alias du='du -h' alias f=finger alias h='history 50' alias l='ls -lh' alias la='ls -aF' alias li='ls -lhi' alias ls='ls -F' alias mail=nail alias mc='echo ERROR with mc ' alias mess='tail -35 /var/log/messages' alias myntpdate='ntpdate -q 0.us.pool.ntp.org' alias nslookup='nslookup -sil' alias p7zip=7za alias path='echo PATH=$PATH' alias ping='ping -v' alias pps='ps w -cfA' alias ppwd=/bin/pwd alias quota='quota -vs' alias rehash='hash -r' alias rm='rm -i' alias rrm='rm -rf' alias su='LEVEL=0 su' alias showtemp="nc localhost 7634 | sed -e 's,|/dev/,\n&,g'; echo" alias whereis='command -v' alias wp='ssh wpollock@wpollock.com' alias yb='ssh wpollock@yborstudent.hccfl.edu' alias ybsync='rsync -HavAXuz --include=/.bashrc --include=/.vim/*** --include=/.bash_profile --exclude=/.* --exclude=/tmp/*** --exclude=/private/journal --exclude=secret.txt yborstudent:./ ~' if test $(id -u) -eq 0 then alias cp='cp -i' alias mv='mv -i' PCHAR='#' else PCHAR='$' fi # Define shell functions: lsc() { ls -C $* | more; } calc() { echo "$*" | bc -l; } ip2bin() { NUMS=$(printf '%s\n' "$@" | sed -e 's/[^[:digit:]]/\n/g') printf 'obase=2\nibase=10\n%s\n' "$NUMS" | bc -l \ | sed -e 's/^/0000000/' -e 's/.*\(.\{8\}\)/\1/' \ | xargs printf '%s ' echo } cmd() { apropos "$@" | egrep '\((1|8)' | less; } rand() { awk 'BEGIN {srand();printf "%d\n", (rand() * 10^8);}'; } lt() { /bin/ls -lt "$@" | head; } # Set the Prompt: # Setting PROMPT_COMMAND this way will set the window title (and icon text): if ! expr "$(tty)" : "/dev/tty.$" >/dev/null; then PROMPT_COMMAND='printf "\e]0;$(id -nu)@$(hostname -f): $PWD\a"' else PROMPT_COMMAND= fi # LEVEL should be set to zero and exported in login script first: let 'LEVEL = LEVEL + 1' # If LEVEL is 1 this is a "root" (top-level) window. If not 1, # this may be a root window if using X, since that fires up xterm # as a non-login shell. But in that case SHLVL > LEVEL. Tricky! if [ "$LEVEL" -eq 1 -o "${SHLVL-0}" -ne "$LEVEL" ] then PS1='\n\[$(tput bold)\]\u@\h\[$(tput sgr0)\] $PWD\n$PCHAR ' SHLVL=1 LEVEL=1 [ "$PCHAR" = "$" ] && set -o ignoreeof else PS1='\n\[$(tput bold)\]\u@\h\[$(tput sgr0)\] ($LEVEL) $PWD\n$PCHAR ' fi