kravella
asked on
changing the prompt
How can I change my '$'prompt to any other prompt.I heard that it is done by using .cshrc file.How to access it ?Give me a step by step method from the time of login.
You mentioned $ prompt - so are you using the Korn shell or Bourne shell?
I asumed csh, since kravella asked about .cshrc,
But you're right, we should verify which shell is being used.
But you're right, we should verify which shell is being used.
ASKER
Adjusted points to 100
I was just wondering - the $ prompt is generally no the default one in C shell.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here's something that I use in my .profile file.
I am using Korn shell.
dasu(){
cd $1
PS1="`pwd`>"
}
alias cd=dasu
cd
I am using Korn shell.
dasu(){
cd $1
PS1="`pwd`>"
}
alias cd=dasu
cd
to pagladasu:
The Korn shell variable, $PWD is set by ksh to be the current value of pwd. You can verify this by "echo $PWD" from the shell prompt. So, to set your prompt to be the current working directory in the Korn shell, without declaring an alias, you can use the following in your .profile;
export PS1="\$PWD>"
Cheers,
--frankf
The Korn shell variable, $PWD is set by ksh to be the current value of pwd. You can verify this by "echo $PWD" from the shell prompt. So, to set your prompt to be the current working directory in the Korn shell, without declaring an alias, you can use the following in your .profile;
export PS1="\$PWD>"
Cheers,
--frankf
to frankf - righto, it works.
pagladasu
pagladasu
As the System prompt is held in variable PS1.
Edit either /etc/profile - to define same prompt for all users or .profile in home directory of a user
and define variable PS1, ie
PS1='$PWD) '
export PS1
This shows current dir (like dos prompt).
you have to export it to make it valid in sub-shells.
If you want to display hostname as well you can define something like :
HOST=$(hostname) - Korn shell only OR
HOST=`hostname`
PS1='[$HOST] - $PWD > '
export PS1
Edit either /etc/profile - to define same prompt for all users or .profile in home directory of a user
and define variable PS1, ie
PS1='$PWD) '
export PS1
This shows current dir (like dos prompt).
you have to export it to make it valid in sub-shells.
If you want to display hostname as well you can define something like :
HOST=$(hostname) - Korn shell only OR
HOST=`hostname`
PS1='[$HOST] - $PWD > '
export PS1
man csh