troubleshooting Question

Title: Easy question - Setting the default 'prompt' (Like DOS set prompt=$p$g)

Avatar of cool12399
cool12399 asked on
Unix OS
4 Comments1 Solution417 ViewsLast Modified:

I asked this question a few days ago, got what I thought was the right answer, but just
realized it is not exactly what I was looking for, so asking it again...

What I was looking for is a 'command' that *every time* you changed the directory (from
shell access), updated the 'current' directory in the prompt.

I.e., something like this:

\var\www> cd \var
\var> cd \var\www\mainsite\testing123
\var\www\mainsite\testing123> some other command

The proposed solution which works *once* when you log in (but then never changes the prompt)

                  vi .profile

                  Then add:

                  PS1="[${PWD}] "
                  export PS1

What can I add to the "PS1", such that it *always* changes the pwd prompt? I am guessing
just a simple shell command? (Unfortunately it's been a while since I needed to do that,
so I forget what I have to do..., but I know it's a simple line! :))

Thanks very much!

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros