Subject: Re: pkg/16226 (new patch for review)
To: Christopher Richards <richards+netbsd@CS.Princeton.EDU>
From: Julio Merino <jmmv@menta.net>
List: tech-userlevel
Date: 01/18/2003 20:13:20
On 18 Jan 2003 13:46:14 -0500
Christopher Richards <richards+netbsd@CS.Princeton.EDU> wrote:
> # Print the working directory, etc. in the prompt
> _user=`whoami`
> _host=`hostname`
> _host_short=${_host%%.*}
>
> cd_prompt () {
> command cd "$@"
> export PWD
> case $PWD in
> $HOME*) PS1="${_host_short}:~${PWD##${HOME}}" ;;
> *) PS1="${_host_short}:$PWD" ;;
> esac
> case $TERM in
> xterm*|rxvt*|cygwin)
> echo -n "]2;${PS1}]1;${PS1}" ;;
> esac
> case ${_user} in
> root) PS1="${PS1}# " ;;
> *) PS1="${PS1}\$ " ;;
> esac
> }
>
> alias cd='cd_prompt'
Do you expect newcomers to know to write all this stuff? linux'ers will
know how bash works and will try that. Just to say that implementing it
inside sh will be faster than calling a shell-script function.
--
Julio M. Merino Vidal <jmmv@menta.net>
The NetBSD Project - http://www.NetBSD.org/