[buug] How to show directory at prompt?
Gary Yang
garyyang6 at yahoo.com
Thu Jan 31 13:58:50 PST 2008
Hi,
My path includes several directories. See below as an example.
hostname:gary_scripts>pwd
/work/gary/gary_scripts/cm/MAIN
I only want to show the directory, gary_scripts (the third directory in the path) at the prompt. The directory gary_scripts shows at the prompt when I am in this directory or its sub-directories. It is not showed at prompt if I am not under this directory. I can easily make it in Korn Shell using the lines below. I put these two lines in a file and source it. But, I am no good at C-Shell. Anyone has idea of how to do it in C-Shell?
my_cd() { \cd "$1"; PS1="`hostname`:`pwd | awk -F/ '{print $4}'`>"; }
alias cd=my_cd
Thanks,
Gary
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buug.org/pipermail/buug/attachments/20080131/0d949eae/attachment.html>
More information about the buug
mailing list