Is it possible to have environment variables in the path of the working directory : PS1?

Posted by mthpvg on Super User See other posts from Super User or by mthpvg
Published on 2012-10-26T10:13:09Z Indexed on 2012/10/26 11:04 UTC
Read the original article Hit count: 154

Filed under:
|
|
|

I am on Lubuntu and I am using bash. My PS1 (in .bashrc) is :

PS1="\w> "

I like it because I need to paste the working directory all the time. The problem is that the path is always very long and since I use terminator I only have half of my screen's width available to display it... it is ugly and annoying. My command prompt looks like that :

/this/is/a/very/long/path/that/i/want/to/make/shorter >

I'd like to set in my environment variables :

$tiavl=/this/is/a/very/long

And then I'll get :

$tiavl/path/that/i/want/to/make/shorter >

The goal is to have something shorter in the command prompt but I still want to be able to copy paste it and do :

cd $tiavl/path/that/i/want/to/make/shorter

It is a bit like with $HOME :

~/path/that/i/want/to/make/shorter  >

I know where I am and I can copy paste the ~.

Thanks.

© Super User or respective owner

Related posts about linux

Related posts about bash