Added: 9 months ago
From: metalx1000
Views: 1,093
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (25)

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

  • @ferodynamics: Ah, Thanks to the clarification. I'm sure other will find this info useful.

  • cd ~

    sudo gedit .bashrc

    export PROMPT_DIRTRIM=3

  • @JeremyPassarelli: Shouldn't have to "sudo" your own .bashrc files.

  • Comment removed

  • Awesome tip. I just put it in my bashrc. Thanks. I have a question though. What if you wanted to only show a certain number of characters in the folder name. I have some folder names that are ridiculously long. I would like to change from say /home/superoctopus/blah to home/super../blah Is there a way to do that as well?

  • @dodo3773: Good question. I don't know. I'm sure it is possible. If I find out, I'll be sure to do a video on it.

  • @metalx1000 I will stay tuned. I am looking at the bash man page now. I am thinking it may be more of a ps1 thing though. Looking forward to future videos.

  • @dodo3773: I found a python script someone wrote that does that when you run the script, but then each time you change the directory you have to run the script again. So, not really what we are looking for, but it's a start :)

  • @metalx1000 I feel like there has got to be some kind of ps1 or bash way to do it. I am leaning more towards ps1 for some reason. I will look into it too and post back if I find something too.

  • mkdir -p newdir/filmsbykris/bashscripti­nfo/webpagedata/dataloginfo is easier :P

    cd new tab tab tab etc

  • @scorici: Thank you. I knew a while ago there was a way to create multiple subdirectories at once. But, some where along the way I forgot how to do it and you just reminded me. Thank you.

  • @metalx1000 np , ty for all your tutorials

  • Useful video and cool channel - thanks!

  • dat intro. (is freakin awesome)

  • @shinigamiauthor: Thanks, I wanted to make my own music for it, so I decided to update it all together. I made it in Blender 3D.

  • Pleasant music :)

  • @Rypervenche: Thanks, Made it myself :)

  • Thanks!

  • @tirmons: No Problem.

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