v1.1 regex fix

This commit is contained in:
claustromaniac 2018-04-25 19:44:41 +00:00 committed by GitHub
parent 94f86465e6
commit 46542e43e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@
## prefs.js cleaner for Linux/Mac ## prefs.js cleaner for Linux/Mac
## author: @claustromaniac ## author: @claustromaniac
## version: 1.0 ## version: 1.1
## special thanks to @overdodactyl and @earthlng for a few snippets that I stol..*cough* borrowed from the updater.sh ## special thanks to @overdodactyl and @earthlng for a few snippets that I stol..*cough* borrowed from the updater.sh
@ -36,7 +36,7 @@ fFF_check() {
fClean() { fClean() {
# the magic happens here # the magic happens here
prefs="@@" prefs="@@"
prefexp="user_pref[ ]*\([ ]*[\"']([^\"']*)[\"'][ ]*," prefexp="user_pref[ ]*\([ ]*[\"']([^\"']+)[\"'][ ]*,"
while read -r line; do while read -r line; do
if [[ "$line" =~ $prefexp && $prefs != *"@@${BASH_REMATCH[1]}@@"* ]]; then if [[ "$line" =~ $prefexp && $prefs != *"@@${BASH_REMATCH[1]}@@"* ]]; then
prefs="${prefs}${BASH_REMATCH[1]}@@" prefs="${prefs}${BASH_REMATCH[1]}@@"
@ -58,7 +58,7 @@ echo -e "\n\n"
echo " ╔══════════════════════════╗" echo " ╔══════════════════════════╗"
echo " ║ prefs.js cleaner ║" echo " ║ prefs.js cleaner ║"
echo " ║ by claustromaniac ║" echo " ║ by claustromaniac ║"
echo " ║ v1.0 ║" echo " ║ v1.1 ║"
echo " ╚══════════════════════════╝" echo " ╚══════════════════════════╝"
echo -e "\nThis script should be run from your Firefox profile directory.\n" echo -e "\nThis script should be run from your Firefox profile directory.\n"
echo "It will remove any entries from prefs.js that also exist in user.js." echo "It will remove any entries from prefs.js that also exist in user.js."