Move bin/back to alias function

This commit is contained in:
Henrik Lissner 2016-04-14 12:55:44 -04:00
parent 91366497ed
commit 09309b7ab6
2 changed files with 9 additions and 10 deletions

View file

@ -1,10 +0,0 @@
#!/usr/bin/env bash
# Jump to a parent directory
dir=$({
_path=$PWD
while [[ -n "$_path" && "$_path" != "/" ]]; do
_path=$(dirname "$_path")
echo "$_path"
done
} | grep -i "$*" | tail -1) && cd "$dir"

View file

@ -36,6 +36,15 @@ fi
## Fast folder navigation #################################################### ## Fast folder navigation ####################################################
alias b="back" alias b="back"
back() { # Jump to a parent directory
dir=$({
_path=$PWD
while [[ -n "$_path" && "$_path" != "/" ]]; do
_path=$(dirname "$_path")
echo "$_path"
done
} | grep -i "$*" | tail -1) && cd "$dir"
}
## Redefined tools ########################################################### ## Redefined tools ###########################################################
# Always enable colored `grep` output # Always enable colored `grep` output