added maintennance option

This commit is contained in:
q
2013-01-07 12:57:44 +02:00
parent e9bcc15796
commit 00b36ff401

View File

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