## This is a mess, and needs tidying up. Hopefully it works on linux and (free)bsd, and can be sourced repeatedly without making PATH grow each time. export LANG=en_GB.UTF-8 if [[ $- != *i* ]]; then # Non-interactive shell return fi export HOSTNAME=${HOSTNAME:-$(hostname -s)} # need -s above for BSD, but that returns localhost on some linuxen [[ "x${HOSTNAME}" == "xlocalhost" ]] && export HOSTNAME=$(hostname) export HOST=$HOSTNAME export USER=${USER:-$(whoami)} #if [[ x$SCRIPT == x ]] #then # script -q typescripts/script-`date +%Y%m%d%H%M%S``tty|tr / -`-$$ # exit #fi ## use _ for "internal" functions, and - for those intended to be used ## interactively do_interesting_prompt() { prompt_choice=$1 # col for colour, not column reset_col='\[\e[0m\]' sif_col='\[\e[0;35m\]' tyr_col='\[\e[0;36m\]' gaius_col='\[\e[0;33m\]' gendros_col='\[\e[1;37m\]' mnason_col='\[\033[01;32m\]' host_col=$reset_col # TODO make all of these unique again [[ "x$HOST" == "xsif" ]] && host_col=$sif_col [[ "x$HOST" == "xtyr" ]] && host_col=$tyr_col [[ "x$HOST" == "xsagacity" ]] && host_col=$tyr_col [[ "x$HOST" == "xwolfman" ]] && host_col=$tyr_col [[ "x$HOST" == "xgaius" ]] && host_col=$gaius_col [[ "x$HOST" == "xgendros" ]] && host_col=$gendros_col [[ "x$HOST" == "xCHESTER" ]] && host_col=$gendros_col [[ "x$HOST" == "xtriton" ]] && host_col=$gendros_col [[ "x$HOST" == "xmnason" ]] && host_col=$mnason_col djm_col='\[\e[0;32m\]' wiz_col='\[\e[1;32m\]' deejayem_col='\[\e[1;32m\]' user_col=$reset_col [[ "x$USER" == "xdjm" ]] && user_col=$djm_col [[ "x$USER" == "xwizard" ]] && user_col=$wiz_col [[ "x$USER" == "xdeejayem" ]] && user_col=$deejayem_col [[ "x$USER" == "xdavidmo" ]] && user_col=$deejayem_col at_col='\[\e[0;37m\]' [[ -n "$SSH_CLIENT" ]] && at_col='\[\e[1;33m\]' time_col='\[\e[0;36m\]' # don't clash with host_col [[ "x$HOST" == "xtyr" ]] && time_col='\[\e[1;33m\]' [[ "x$HOST" == "xsagacity" ]] && time_col='\[\e[1;33m\]' [[ "x$HOST" == "xwolfman" ]] && time_col='\[\e[1;33m\]' dir_col='\[\e[1;34m\]' sb_col=$reset_col # Square brackets rb_col='\[\e[0;32m\]' # Round brackets cb_col='\[\e[0;32m\]' # Curly brackets cn_col='\[\e[0;35m\]' # Command numbers # Should vaguely correspond to user_col, but emphasise whether or not # we're using ssh (shutting down the wrong machine is not cool) prompt_col='\[\e[0;32m\]' [[ -n "$SSH_CLIENT" ]] && prompt_col='\[\e[1;32m\]' # col for colour, not column (still) # \h on first line as well as the second, because ^R obscures the second if [[ $prompt_choice -eq 1 ]]; then export PS1="$time_col\d \t $cb_col{$host_col\h$cb_col}\n$sb_col[$user_col\u$at_col@$host_col\h $dir_col\w$sb_col]$rb_col($cn_col\#:\j:"'$?'"$rb_col)$prompt_col\$$reset_col " elif [[ $prompt_choice -eq 2 ]]; then export PS1="$sb_col[$user_c
*~
*.pyc
*.pyo
stuff/*