Shorten Prompt - BASH - Linux
Loading...
1,091
Loading...
Uploader Comments (metalx1000)
see all
All Comments (25)
-
@ferodynamics for more info, Google "Printing-a-Prompt" and the Bash docs should be the first result. Fedora's /etc/bashrc is pretty ugly, it's a lot of if-else conditional stuff but fortunately the solution was easy enough. Just change one character.
-
@JeremyPassarelli: Shouldn't have to "sudo" your own .bashrc files.
-
cd ~
sudo gedit .bashrc
export PROMPT_DIRTRIM=3
Loading...
Doesn't work with Fedora.
ferodynamics 7 months ago
@ferodynamics: Should be built into BASH. Are you using BASH or another Shell?
metalx1000 7 months ago
@metalx1000 I'm using "GNU bash, version 4.1.7(1)-release (i386-redhat-linux-gnu)"
ferodynamics 7 months ago
@ferodynamics:
I'm using "GNU bash, version 4.2.8(1)-release (i686-pc-linux-gnu)"
From everything I'm reading PROMPT_DIRTRIM should be built into Bash 4.
But maybe not.
metalx1000 7 months ago
Alright, you convinced me to look this up because it's something I've always wanted since starting to use Fedora, but it never seemed like a priority until now. I read the Bash documentation and apparently "\W" ignores DIRTRIM BUT "\w" recognizes DIRTRIM. So in my case I had to edit /etc/bashrc and about halfway through the file there is a $PS1 = blah blah, look for the \W and change it to lowercase \w and that's it, now DIRTRIM works.
ferodynamics 7 months ago
@ferodynamics: Ah, Thanks to the clarification. I'm sure other will find this info useful.
metalx1000 7 months ago