Move bin/back to alias function
This commit is contained in:
parent
91366497ed
commit
09309b7ab6
10
bin/back
10
bin/back
|
@ -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"
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue