Skip to content

Instantly share code, notes, and snippets.

@andywenk
Created April 13, 2010 20:36
Show Gist options
  • Save andywenk/365056 to your computer and use it in GitHub Desktop.
Save andywenk/365056 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script deletes the extensions.cache, extensions.ini and
# extensions.rdf files because of trouble with Firefox 2 and 3
# running togehter on the same machine
# usage: ./delFirefoxExtFiles [folder]
# if the folder was submitted we save it in DEFFOLDER
DEFFOLDER="$1"
# if no folder was submitted, we ask to do so
while [ "$DEFFOLDER" = "" ]
do
echo "Which is the default folder (not path)?"
read DEFFOLDER
done
# we ask if the path is correct
FOLDERPATH="$HOME/.mozilla/firefox/$DEFFOLDER.default/"
echo
echo "Checking folderpath ..."
if [ -d "$FOLDERPATH" ]; then
echo "The folderpath is" $FOLDERPATH ". Is that correct (Y/N)?"
read YESNO
if [ "$YESNO" = "N" ];then
exit
fi
else
echo "The path is invalid!"
echo "Exiting ..."
exit
fi
echo
# check if firfox is running. If yes exit
echo "Checking if firefox is running ..."
FIREFOX=`ps aux | grep firefox`
if [ "$FIREFOX" != "" ]; then
echo "Firefox is running! Please shutdown first ..."
echo "Exiting ..."
exit
fi
echo
# message
echo "Now deleting files ..."
# delete the files
echo "Deleting extensions.cache ..."
if [ -f $FOLDERPATH"extensions.cache" ];then
rm -f $FOLDERPATH"extensions.cache"
echo "done ..."
else
echo "not a file ... skipping ..."
fi
echo "Deleting extensions.ini ..."
if [ -f $FOLDERPATH"extensions.ini" ];then
rm -f $FOLDERPATH"extensions.ini"
echo "done ..."
else
echo "not a file ... skipping ..."
fi
echo "Deleting extensions.rdf ..."
if [ -f $FOLDERPATH"extensions.rdf" ];then
rm -f $FOLDERPATH"extensions.rdf"
echo "done ..."
else
echo "not a file ... skipping ..."
fi
echo
echo "All files are succesfully deleted! Bye!"
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment