Skip Tavakkolian writes:
> suppose i have these lines in the cpu section of my $home/lib/profile:
>
> prompt=3D($sysname^'% ' ' ')
> fn $sysname^%{ $* }
>
> what is the utility of the func on the second line?
:-)
Here is my version from Unix (I have a Plan9 one as well):
setprompt () {
PS1=": "$(id -un)@$(hostname|sed 's;\..*$;;'):$(pwd -L|sed -e
s%${HOME}%~%)'; '
}
cd () {
command cd "$@" && setprompt
}
setprompt
This works with just about every Unix shell, although I stay
parked in ksh whenever possible.
The 'sed' fragmant can probably be removed and '-s' added to the
hostname command. It's there from days gone by when one of the
Unixen I used didn't support -s. And I find including the path is
immensely helpful. In some cases, I will left-truncate it at
32-or-so chars. Not an issue on plan9 as if I get that deep into
a diretory maze, I just bind it to a shorter name.
--lyndon
------------------------------------------
9fans: 9fans
Permalink:
https://9fans.topicbox.com/groups/9fans/Tfc2f1095f79c2bb7-M196684fe4e50227d571fa3af
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription