SUMMARY: nastavenie promptu

From: intas!Fri@relay.acns.nwu.edu
Date: Fri Jan 17 1997 - 08:53:24 CST


Hi suners,

my original question was how to set prompt for csh, to show actual directory.
I was flude with lot of answers. Thanks to all who responded.

dodi

Here are the best of answers:

----------------------------------------------------------------------------
You have the right idea but as far as I know you will have to set an alias
for "cd" also:

cd cd !*; set prompt = "${OSTYPE}:`uname -n`:`pwd` > "

OSTYPE is just a variable we use at our site....
----------------------------------------------------------------------------
Hello,

try the following stuff in your .cshrc

alias setdirinfo 'set Wd=$cwd:h;set dirinfo="$P$Wd:t/$cwd:t";unset Wd'
alias setprompt 'set prompt="[$dirinfo] <\\!> "'
alias xheader 'echo -n ""' # sets window title
alias xiheader 'echo -n ""' # sets icon label
alias cd 'chdir \!*; setdirinfo; setprompt; xheader " ${host}: $cwd "; xiheader " ${host} "'
cd .
----------------------------------------------------------------------------
This will no work in the bourne shell.
Use the korn shell :
        PS1="`uname -n`.\$PWD: "
        export PS1

Rob.
----------------------------------------------------------------------------
      For csh you just need to alias cd to change directory and set the prompt.

alias cd 'cd "\!:1*"; set prompt="`pwd`:"'
----------------------------------------------------------------------------
This is fragment from my .cshrc file:

alias cd 'set old=$cwd; chdir \!*; set prompt="#"$user":"$cwd"> "'
set prompt="#"$user":"$cwd"> "

When you try to cahnge directory with cd command - it will be change
$prompt variable for new directory name.
----------------------------------------------------------------------------
Try this:-

'cd \!*;set prompt="$user@$host `basename $cwd` % "'

than do:-

alias pwd 'echo $cwd'

Put both of these in your .cshrc file. Someone else may come up with
something better.... :)
----------------------------------------------------------------------------
Add also an alias to the "cd" command to update the prompt..

Or use those 2 alias and the current working directory will appear in the
top of your cmdtool in openwin...
> alias cd 'cd \!:* && echo -n "^[]l [`hostname`] `echo $cwd` ^[\"'
> alias pwd 'pwd \!:* && echo -n "^[]l [`hostname`] `echo $cwd` ^[\"'
----------------------------------------------------------------------------
set an alias:

        cd cd !*; set prompt="`whoami`-`hostname`:`pwd`> "
----------------------------------------------------------------------------



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:43 CDT