Solved

changing  the prompt

Posted on 1998-11-22
10
229 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
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
 

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now