I am trying to set prompt of the shell to show atleast last 3 directories.

I am using the following to show present working directory,

set prompt = " %~>" (Home directory will be replace with ~ in the prompt)

Right now, the prompt shows up like this

/root/MyDir1/MyDir2/MyDir3/MyDir4/MyDir5> _

I want it to be shown like this or so

MyDir3/MyDir4/MyDir5> _

Is there a way to set the prompt to show atleast the last 3 directories?

Browse other questions tagged or ask your own question.