Solved

changing  the prompt

Posted on 1998-11-22
10
254 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
Industry Leaders: 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

707 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