Shell `cd`replacement
Everybody has one of those ~/code, ~/dev, ~/development, ~/workspace, ~/you-name-it folders.
We have many projects inside and we like to group things.
For instance, if I want to hack on Cocoapods/Core, here's what I need to type:
$ cd code/OSS/Cocoapods/Core
Or, if I've just checked out some random open source stuff,
$ cd code/Playground/RandomProject
As you may cd
to projects many times a day, this one might help you:
(It's also case-insensitive)
# wo = work on
wo() {
code_dir=~/code # replace it with your development directory
cd $(find $code_dir -type d -maxdepth 3 | grep -i $* | grep -Ev Pods --max-count=1)
}
Just copy this to your .bashrc, or .zshrc, or even better, .aliases if you keep a separate file for them.
Usage:
$ wo core
# enters ~/code/OSS/Cocoapods/Core on my machine
$ wo sugar
# enters ~/code/OSS/ObjectiveSugar
Note that you can also switch between projects, without cd ..
Written by Marin Usalj
Related protips
1 Response
Cool script! I'm gonna try it out.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mneorr
Authors
supermarin
25.48K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#