Solved

changing  the prompt

Posted on 1998-11-22
10
246 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
Independent Software Vendors: 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 100 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

726 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