# $Id$ # Commands to run for any interactive POSIX shell. # Examples include the prompt and any terminal-specific code. # It is called by sh via $ENV, bash via .bashrc, and zsh via .zshrc. case $- in *i*) # common environment if test -f "$HOME/.env" then . "$HOME/.env" fi # terminal colors, etc. terminit # prompt and window title connectioninfo='$(short_hostname)' #command=${0#-} command= commandinfo='$([ -n "$mytitle" ] && echo "$mytitle" || printf "%s" "$command")' shellinfo='$(short_hostname):$(dirs -v)' promptchars='$(prompt_character)' promptcolor=normal errorcolor=red promptstring=' $(short_hostname):$(tilde_directory) $(git_branch) $(prompt_character) ' title='$(eval printf "%s" "\"${connectioninfo} ${commandinfo}\"")' PS1='$(eval settitle "\"${title}\"")$(setcolor ${promptcolor})$(eval printf "%s" "\"${promptstring}\"")$(setcolor "normal")$(bell)' PS2='> ' #PS2='_ ' PS3='? ' PS4='+ ' # make standard error red rederr() { while read -r line do setcolor $errorcolor echo "$line" setcolor normal done } # errfifo=${TMPDIR:-/tmp}/errfifo.$$ # mkfifo $errfifo # # to silence the line telling us what job number the background job is # exec 2>/dev/null # rederr <$errfifo& # errpid=$! # disown %+ # exec 2>$errfifo # command line editing key bindings (must be set after EDITOR and VISUAL) set -o emacs 2>/dev/null # colors for ls case "$TERM" in linux|putty|vt220) # colors for white on black #export LSCOLORS='gxcxxxxxfxxxxx' export LSCOLORS='ExFxxxxxCxxxxx' export LS_COLORS='no=00:fi=00:di=01;34:ln=01;35:so=00;00:bd=00;00:cd=00;00:or=01;31:pi=00;00:ex=01;32' ;; *) # colors for black on white export LSCOLORS='exfxxxxxcxxxxx' export LS_COLORS='no=00:fi=00:di=00;34:ln=00;35:so=00;00:bd=00;00:cd=00;00:or=00;31:pi=00;00:ex=00;32' ;; esac if exists dircolors then if test -f "$HOME/.dircolors.$TERM" then dircolors="$HOME/.dircolors.$TERM" else case "$TERM" in linux|putty|vt220) if test -f "$HOME"/.dircolors.dark then dircolors="$HOME"/.dircolors.dark fi ;; *) if test -f "$HOME"/.dircolors.light then dircolors="$HOME"/.dircolors.light fi ;; esac fi if test -z "$dircolors" then if test -f "$HOME"/.dircolors then dircolors="$HOME"/.dircolors fi fi if test -n "$dircolors" then eval $(dircolors -b "$dircolors" 2>/dev/null) fi fi # local settings (company environment, network, etc.) test -r "$HOME"/.shrc.local && . "$HOME"/.shrc.local ;; esac # workaround for GNOME Terminal which does a cd on startup :-( if test -n "$DISPLAY" then # e.g. Mikel-PC or Mikel-Laptop means local case "$HOST" in $USER-*) cd ;; esac # assuming DISPLAY=:0.0 means local # note that DISPLAY=localhost:0.0 can mean SSH X forwarding case "$DISPLAY" in :*) cd ;; esac fi # finish with a zero exit status true