Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zsh question



(Bcced to zsh-users because of possible interest there.  zsh-users
readers, make sure you don't accidentally reply to fysh@xxxxxxxxx)

Giles Constant wrote:
>[pts/2] :)                                              ~/doc [flivoreuse]
>
>Benbar came up with the amusing idea of making the smiley prompt change
>randomly every time I hit return (or even change to something that
>reflects the load of the machine).

Cool idea.

PS1='[%l] %1v '
function precmd {
  setopt no_ksh_arrays local_options
  case "${${$(uptime)##*"load average: "}%%,*}" in
    0.[0-4]*) psvar[1]=':-)' ;;
    0.[5-9]*) psvar[1]=':-}' ;;
    1.*)      psvar[1]=':-]' ;;
    2.*)      psvar[1]=':-|' ;;
    3.*)      psvar[1]=':-[' ;;
    [45].*)   psvar[1]=':-{' ;;
    [67].*)   psvar[1]=':-(' ;;
    *)        psvar[1]='|-O' ;;
  esac
}

-zefram



Messages sorted by: Reverse Date, Date, Thread, Author