added maintennance option
This commit is contained in:
20
qcd_function
20
qcd_function
@@ -13,7 +13,7 @@ function cd_history () {
|
|||||||
alias cd=cd_history
|
alias cd=cd_history
|
||||||
|
|
||||||
function qcd() {
|
function qcd() {
|
||||||
while getopts alh opt
|
while getopts alhm opt
|
||||||
do case "$opt" in
|
do case "$opt" in
|
||||||
a)
|
a)
|
||||||
# Adding
|
# Adding
|
||||||
@@ -32,6 +32,21 @@ function qcd() {
|
|||||||
echo ==Saved ~/.qcd:
|
echo ==Saved ~/.qcd:
|
||||||
cat ~/.qcd
|
cat ~/.qcd
|
||||||
;;
|
;;
|
||||||
|
m)
|
||||||
|
IFS=$'\n'
|
||||||
|
for line in $( cat ~/.bash_cdhistory );
|
||||||
|
do if [ -d "${line/*:/}" ];
|
||||||
|
then echo "$line" >> ~/.bash_cdhistory.tmp
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
mv ~/.bash_cdhistory.tmp ~/.bash_cdhistory
|
||||||
|
for line in $( cat ~/.qcd );
|
||||||
|
do if [ -d "${line/*:/}" ];
|
||||||
|
then echo "$line" >> ~/.qcd.tmp
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
mv ~/.qcd.tmp ~/.qcd
|
||||||
|
;;
|
||||||
h)
|
h)
|
||||||
echo "qcd [-al] [name]"
|
echo "qcd [-al] [name]"
|
||||||
echo "Change current working path based on the list ~/.qcd"
|
echo "Change current working path based on the list ~/.qcd"
|
||||||
@@ -44,6 +59,9 @@ function qcd() {
|
|||||||
echo " "
|
echo " "
|
||||||
echo "qcd -l "
|
echo "qcd -l "
|
||||||
echo " Lists the paths"
|
echo " Lists the paths"
|
||||||
|
echo " "
|
||||||
|
echo "qcd -m "
|
||||||
|
echo " Maintain the list files, deleting non-existing entries"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user