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