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.
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?
@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.
@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.
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 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 7 months ago
@ferodynamics: Ah, Thanks to the clarification. I'm sure other will find this info useful.
metalx1000 7 months ago
cd ~
sudo gedit .bashrc
export PROMPT_DIRTRIM=3
JeremyPassarelli 8 months ago
@JeremyPassarelli: Shouldn't have to "sudo" your own .bashrc files.
metalx1000 8 months ago
Comment removed
JeremyPassarelli 8 months ago
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 8 months ago
@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 8 months ago
@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 8 months ago
@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 8 months ago
@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.
dodo3773 8 months ago
mkdir -p newdir/filmsbykris/bashscriptinfo/webpagedata/dataloginfo is easier :P
cd new tab tab tab etc
scorici 8 months ago
@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 8 months ago
@metalx1000 np , ty for all your tutorials
scorici 8 months ago
Useful video and cool channel - thanks!
goldieken 8 months ago
dat intro. (is freakin awesome)
shinigamiauthor 8 months ago
@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.
metalx1000 8 months ago
Pleasant music :)
Rypervenche 8 months ago
@Rypervenche: Thanks, Made it myself :)
metalx1000 8 months ago
Thanks!
tirmons 8 months ago
@tirmons: No Problem.
metalx1000 8 months ago