QCD -e to store match in variable
This commit is contained in:
10
qcd_function
10
qcd_function
@@ -21,7 +21,7 @@ function qcd() {
|
|||||||
local opt
|
local opt
|
||||||
local case
|
local case
|
||||||
|
|
||||||
while getopts aiILl:hm opt
|
while getopts ae:hiILl:m opt
|
||||||
do case "$opt" in
|
do case "$opt" in
|
||||||
a)
|
a)
|
||||||
# Adding
|
# Adding
|
||||||
@@ -73,6 +73,13 @@ complete -F _qcd qcd
|
|||||||
echo $d
|
echo $d
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
e)
|
||||||
|
local d=$( grep $case -h ^"$OPTARG" ~/.qcd <( tac ~/.bash_cdhistory ) | head -n 1 )
|
||||||
|
d="${d/*:/}"
|
||||||
|
echo QCD=$d
|
||||||
|
QCD="$d"
|
||||||
|
return
|
||||||
|
;;
|
||||||
m)
|
m)
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
for line in $( cat ~/.bash_cdhistory );
|
for line in $( cat ~/.bash_cdhistory );
|
||||||
@@ -97,6 +104,7 @@ Keeps a history of folders visited in ~/.bash_cdhistory
|
|||||||
-a [name] Adds the path to the list
|
-a [name] Adds the path to the list
|
||||||
You may add the name of the path, but when omitted
|
You may add the name of the path, but when omitted
|
||||||
the basename will be used
|
the basename will be used
|
||||||
|
-e [name] Show the match, store in variable QCD
|
||||||
-i Case insensitive search, must come first.
|
-i Case insensitive search, must come first.
|
||||||
-I Install, with autocompletion (use only once)
|
-I Install, with autocompletion (use only once)
|
||||||
-l [name] Show the match, but do not change
|
-l [name] Show the match, but do not change
|
||||||
|
|||||||
Reference in New Issue
Block a user