# set colours for use in PROMPT COLOUR1=$'\e[0;32m' COLOUR2=$'\e[0m' # if i am root, use RED [[ "$UID" = "0" ]] && COLOUR1=$'\e[0;31m' PROMPT="(%B%{$COLOUR1%}%m%{$COLOUR2%}[%{$COLOUR1%}%h%{$COLOUR2%}]:%{$COLOUR1%}%~%{$COLOUR2%})%{$COLOUR1%}%%%{$COLOUR2%}%b " export PROMPT # check whether we're in an xterm case $TERM in (xterm*|rxvt) # set the terminal title (precmd is executed before each prompt) precmd () {print -Pn "\e]0;%n@%m: %~\a"} # substitute cwd for current command (preexec is executed just # after a command is read and about to be executed) preexec () {print -Pn "\e]0;%n@%m: $1\a"} ;; esac