Created
June 26, 2015 09:00
-
-
Save peebeebee/a27468df8aaca92fefc3 to your computer and use it in GitHub Desktop.
Handy Shell Functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .bash_profile | |
| # Type `up 7` to do cd ../../../../../../.. | |
| function up() { | |
| i=$1 | |
| while [ $i -gt 0 ] | |
| do | |
| cd .. | |
| i=$(($i - 1)) | |
| done | |
| } | |
| > up 7 | |
| # Instead of counting folders it can be done by typing a few characters of the name of the parent folder you want to go. | |
| function up { | |
| cd `expr "$PWD" : "^\(.*$1[^/]*\)"` | |
| } | |
| > up han |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment