Created
August 6, 2013 21:50
-
-
Save ktravis/6169039 to your computer and use it in GitHub Desktop.
reel is an "up" command for fish, inspired by reddit.
This file contains 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
function reel | |
if test -f $argv[1] | |
cd .. | |
else | |
if pwd | grep -q "$argv[1]" | |
set x (dirname $PWD) | |
while test -z (echo (basename $x) | grep "$argv[1]") | |
set x (dirname $x) | |
end | |
cd "$x" | |
else | |
echo "Directory name containing "$argv[1]" was not found in current path." | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment