1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 22:30:08 +00:00

refactor: Update shell arithmetic increment syntax from ((var++)) || true to var=$((var + 1)) across various scripts.

This commit is contained in:
tw93
2026-02-28 11:10:18 +08:00
parent 7d70889ad4
commit c19a0276b8
22 changed files with 141 additions and 141 deletions

View File

@@ -138,7 +138,7 @@ perform_auto_fix() {
echo -e "${BLUE}Enabling Firewall...${NC}"
if sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on > /dev/null 2>&1; then
echo -e "${GREEN}${NC} Firewall enabled"
((fixed_count++)) || true
fixed_count=$((fixed_count + 1))
fixed_items+=("Firewall enabled")
else
echo -e "${RED}${NC} Failed to enable Firewall"
@@ -154,7 +154,7 @@ perform_auto_fix() {
auth sufficient pam_tid.so
' '$pam_file'" 2> /dev/null; then
echo -e "${GREEN}${NC} Touch ID configured"
((fixed_count++)) || true
fixed_count=$((fixed_count + 1))
fixed_items+=("Touch ID configured for sudo")
else
echo -e "${RED}${NC} Failed to configure Touch ID"
@@ -167,7 +167,7 @@ auth sufficient pam_tid.so
echo -e "${BLUE}Installing Rosetta 2...${NC}"
if sudo softwareupdate --install-rosetta --agree-to-license 2>&1 | grep -qE "(Installing|Installed|already installed)"; then
echo -e "${GREEN}${NC} Rosetta 2 installed"
((fixed_count++)) || true
fixed_count=$((fixed_count + 1))
fixed_items+=("Rosetta 2 installed")
else
echo -e "${RED}${NC} Failed to install Rosetta 2"

View File

@@ -70,7 +70,7 @@ manage_purge_paths() {
line="${line#"${line%%[![:space:]]*}"}"
line="${line%"${line##*[![:space:]]}"}"
[[ -z "$line" || "$line" =~ ^# ]] && continue
((custom_count++)) || true
custom_count=$((custom_count + 1))
done < "$PURGE_PATHS_CONFIG"
fi

View File

@@ -117,7 +117,7 @@ perform_updates() {
if "$mole_bin" update 2>&1 | grep -qE "(Updated|latest version)"; then
echo -e "${GREEN}${ICON_SUCCESS}${NC} Mole updated"
reset_mole_cache
((updated_count++)) || true
updated_count=$((updated_count + 1))
else
echo -e "${RED}${NC} Mole update failed"
fi

View File

@@ -302,7 +302,7 @@ ${GRAY}Edit: ${display_config}${NC}"
cache_patterns+=("$pattern")
menu_options+=("$display_name")
((index++)) || true
index=$((index + 1))
done <<< "$items_source"
# Identify custom patterns (not in predefined list)