changing shell prompt

Posted on 1998-12-17
Medium Priority
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).  
Question by:mpenner
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

Expert Comment

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

Author Comment

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?


Expert Comment

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'

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

LVL 51

Accepted Solution

ahoffmann earned 200 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 ~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 .


Author Comment

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

LVL 51

Expert Comment

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

Author Comment

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
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 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…
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.:
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

777 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