Fix script exit bug caused by ((var++)) with set -e

Critical bug fix:
- Script was exiting after 'Application Configuration Status:'
- Issue: ((total_browsers++)) returns 1 when var is 0
- With 'set -e', non-zero return causes immediate exit
- Solution: Use var=$((var + 1)) instead of ((var++))

Changed all increment operations:
- ((total_browsers++)) → total_browsers=$((total_browsers + 1))
- ((configured_browsers++)) → configured_browsers=$((configured_browsers + 1))

This prevents script termination and allows proper browser detection
to complete and display configuration status for all browsers.
This commit is contained in:
mindesbunister
2025-10-06 09:44:49 +02:00
parent 8e5b6e8036
commit f128291dfe

View File

@@ -561,43 +561,43 @@ analyze_and_prompt() {
# Check each browser
if [[ -d "$user_home/.mozilla/firefox" ]]; then
((total_browsers++))
total_browsers=$((total_browsers + 1))
if grep -q "tmpfs-cache" "$user_home/.mozilla/firefox"/*default*/prefs.js 2>/dev/null; then
echo " ✅ Firefox: Configured"
((configured_browsers++))
configured_browsers=$((configured_browsers + 1))
else
echo " ⚠️ Firefox: Not configured"
fi
fi
if [[ -d "$user_home/.config/BraveSoftware" ]]; then
((total_browsers++))
total_browsers=$((total_browsers + 1))
if [[ -f "$user_home/.local/share/applications/brave-browser.desktop" ]] && \
grep -q "tmpfs-cache" "$user_home/.local/share/applications/brave-browser.desktop" 2>/dev/null; then
echo " ✅ Brave: Configured"
((configured_browsers++))
configured_browsers=$((configured_browsers + 1))
else
echo " ⚠️ Brave: Not configured"
fi
fi
if [[ -d "$user_home/.config/google-chrome" ]]; then
((total_browsers++))
total_browsers=$((total_browsers + 1))
if [[ -f "$user_home/.local/share/applications/google-chrome.desktop" ]] && \
grep -q "tmpfs-cache" "$user_home/.local/share/applications/google-chrome.desktop" 2>/dev/null; then
echo " ✅ Chrome: Configured"
((configured_browsers++))
configured_browsers=$((configured_browsers + 1))
else
echo " ⚠️ Chrome: Not configured"
fi
fi
if [[ -d "$user_home/.config/chromium" ]]; then
((total_browsers++))
total_browsers=$((total_browsers + 1))
if [[ -f "$user_home/.local/share/applications/chromium-browser.desktop" ]] && \
grep -q "tmpfs-cache" "$user_home/.local/share/applications/chromium-browser.desktop" 2>/dev/null; then
echo " ✅ Chromium: Configured"
((configured_browsers++))
configured_browsers=$((configured_browsers + 1))
else
echo " ⚠️ Chromium: Not configured"
fi