"Do you know where I am ??"

"Do you know where I am ??"

Post by Juergen Nickels » Sat, 13 Jul 1991 21:06:17




Ilacqua) writes:

> <Or you can do all of this in bash with just
> >       export PS1='\h: \w:t-\!> "

> or tcsh:
>  set prompt = '%m: %c-%h>'
> or zsh:
>  PROMPT='%m: %c-%h>'

This is what I have for tcsh/csh:

alias cd        'cd \!* ; setprompt'
alias popd      'popd \!* ; setprompt'
alias pushd     'pushd \!* ; setprompt'
alias setprompt 'set prompt="${HOST}: `echo $cwd | sed -e '\''s| .*||'\'' -e '\''s|.*[^/]\(/[^/]*/[^/]*\)|...\1|'\''`) "'

(setprompt code based on work of others.)
This gives me a prompt like this on machine desaster:

Script started on Fri Jul 12 13:59:42 1991
desaster: .../stone/nickel) cd ..
desaster: /home/stone) cd ..
desaster: /export) cd
desaster: .../stone/nickel) cd bin
desaster: .../nickel/bin)
desaster: .../nickel/bin) exit
script done on Fri Jul 12 14:00:10 1991

So I have more information about the path than I would have with
$cwd:t, but the path component doesn't grow too long, imagine:
"desaster: /tmp_mnt/home/stone/nickel/lib/emacs/term) ".
Ugly!

--