?
Solved

changing  the prompt

Posted on 1998-11-22
10
Medium Priority
?
257 Views
Last Modified: 2013-12-16
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.
0
Comment
Question by:kravella
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1812367
echo 'set prompt="any other prompt"' >> ~/.cshrc
man csh
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1812368
You mentioned $ prompt - so are you using the Korn shell or Bourne shell?
0
 
LVL 84

Expert Comment

by:ozo
ID: 1812369
I asumed csh, since kravella asked about .cshrc,
But you're right, we should verify which shell is being used.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kravella
ID: 1812370
Adjusted points to 100
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1812371
I was just wondering - the $ prompt is generally no the default one in C shell.
0
 
LVL 4

Accepted Solution

by:
pagladasu earned 200 total points
ID: 1812372
If you are using the Bourne or Korn shell, you could insert the following line in your
profile file
PS1=")-"
This would change the prompt in this shell

Thanks and all the best
pagladasu
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1812373
Here's something that I use in my .profile file.
I am using Korn shell.

dasu(){
  cd $1
  PS1="`pwd`>"
}
alias cd=dasu
cd

0
 
LVL 2

Expert Comment

by:blowfish
ID: 1812374
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
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1812375
to frankf - righto, it works.
pagladasu

0
 

Expert Comment

by:saila
ID: 1812376
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


0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question