fix: init PROFILE_PATH locally on saveProfile, remove unused item

This commit is contained in:
Kevin Del Castillo 2020-10-27 10:49:16 -05:00
parent 9254c7d0ed
commit 49671092fc
No known key found for this signature in database
GPG Key ID: 0946BE6CF85B4536
1 changed files with 5 additions and 5 deletions

View File

@ -24,6 +24,8 @@ while getopts 'f:p:g:t:h' flag; do
done done
function saveProfile(){ function saveProfile(){
local PROFILE_PATH="$1"
cd $FIREFOXFOLDER/$PROFILE_PATH cd $FIREFOXFOLDER/$PROFILE_PATH
echo "Installing theme in $PWD" echo "Installing theme in $PWD"
# Create a chrome directory if it doesn't exist. # Create a chrome directory if it doesn't exist.
@ -77,14 +79,12 @@ if [ ${#PROFILES_PATHS[@]} -eq 0 ]; then
>&2 echo "failed, no profiles found at ${PROFILES_FILE}" >&2 echo "failed, no profiles found at ${PROFILES_FILE}"
exit 0 exit 0
elif [ ${#PROFILES_PATHS[@]} -eq 1 ]; then elif [ ${#PROFILES_PATHS[@]} -eq 1 ]; then
echo "one profile found" echo "One profile found"
saveProfile "0" "${PROFILES_PATHS[0]}" saveProfile "${PROFILES_PATHS[0]}"
else else
echo "${#PROFILES_PATHS[@]} profiles found" echo "${#PROFILES_PATHS[@]} profiles found"
ITEM=0
for PROFILE_PATH in "${PROFILES_PATHS[@]}"; do for PROFILE_PATH in "${PROFILES_PATHS[@]}"; do
saveProfile "${ITEM}" "${PROFILE_PATH}" saveProfile "${PROFILE_PATH}"
ITEM="$((${ITEM}+1))"
done done
fi fi