In Bash PS1 prompt, \w
refers to the current working directory. Is there any equivalent using a command (best if it supports DIRTRIM env variable too).
I thought of the pwd
command, but if cwd is /home/foo/bar, the value of "\w" should be ~/bar but the output of pwd
is /home/foo/bar. It concludes that pwd is not what I want.