Solved

changing shell prompt

Posted on 1998-12-17
7
256 Views
Last Modified: 2010-11-01
This is probably a fairly easy question, but how do I change a csh prompt so that it display the current directory (like DOS).  
0
Comment
Question by:mpenner
[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
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Expert Comment

by:elfie
ID: 2008447
alias    cd      'cd \!*;set prompt="`pwd`> "'
set prompt="`pwd`> "
0
 

Author Comment

by:mpenner
ID: 2008448
That isn't going to work with something like pushd.  Isn't there some way to put something in the prompt environment variable to do this?


0
 
LVL 3

Expert Comment

by:elfie
ID: 2008449
The alias on is needed to change the prompt when doing a cd.

So if you use pushd, make the same kind of alias for pushd as well, just change 'cd' into 'pushd'




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!

 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 2008450
NO thers is no way doing this in csh, use tcsh instead.

As elfie said, you have to make aliases for cd, pushd, popd, etc.
but keep in mind that theree are somee dragons to beet, like:
  cd
  cd ~
  cd ~user
  pushd +2
  cd to_a_mount_point
  cd to_a_link

Probably you check following to identify what you realy want to have:
   echo $cwd -- `pwd`; df .

0
 

Author Comment

by:mpenner
ID: 2008451
So how would I do it is tcsh?


0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2008452
set prompt = '%/ '
see man tcsh for much more examples ;-)
0
 

Author Comment

by:mpenner
ID: 2008453
Thanks that is exactly what I wanted to find.
0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best way to handle awk return value 6 79
Parsing a file using ksh 10 79
Convert OverPunch 25 68
replace content of certain columns in a *.csv file by a defined string 12 88
Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
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.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

738 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