I do a lot of work in Magento, and so do a lot of the people I work with, and it gets annoying to have to type:
cd ../../../../../../
To only find you're still a few directories from your root 'httpdocs' folder, so I'm trying to make a script that follows this pseudo-code:
while lowest level directory != httpdocs
cd ../
end while;
Seems pretty simple, I'm assuming I would have to do some form of grep on checking if the last part of the current working directory is httpdocs, if not just keep going up a level until it's true.
I've been looking at learning bash for this, though it seems like there has to be something out there already that's similar, and the syntax puzzles me to no end.
upto httpdocs
. – cjm Jun 03 '11 at 09:54jd
does not appear to work in every case, would you mind explaining how it works? – Cesar Jan 19 '12 at 06:22**
). To enable this feature in your bash shell useshopt -s globstar
. – dogbane Jan 19 '12 at 08:37jd
function, see https://gist.github.com/Rob--W/5888648. I've only tested it with Bash 4.2.45, so YMMV. – Rob W Jun 28 '13 at 22:28