QCD -e to store match in variable

This commit is contained in:
ville rantanen
2014-02-10 09:30:47 +02:00
parent a906caee1a
commit 4acaee44f9

View File

@@ -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