Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Shorten Prompt - BASH - Linux

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
1,091
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Link to this comment:

Share to:

Uploader Comments (metalx1000)

  • Doesn't work with Fedora.

  • @ferodynamics: Should be built into BASH. Are you using BASH or another Shell?

  • @metalx1000 I'm using "GNU bash, version 4.1.7(1)-release (i386-redhat-linux-gnu)"

    

  • @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.

  • 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: Ah, Thanks to the clarification. I'm sure other will find this info useful.

see all

All Comments (25)

Sign In or Sign Up now to post a comment!
  • @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...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more