1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-08 04:29:24 +00:00

fix: Improve shell script robustness by adding variable validation and safer du output parsing.

This commit is contained in:
Tw93
2025-12-30 18:07:48 +08:00
parent fcde129d2f
commit bb49ec3170
4 changed files with 14 additions and 7 deletions

View File

@@ -122,7 +122,7 @@ whitelist_skipped_count=0
# shellcheck disable=SC2329
note_activity() {
if [[ $TRACK_SECTION -eq 1 ]]; then
if [[ "${TRACK_SECTION:-0}" == "1" ]]; then
SECTION_ACTIVITY=1
fi
}
@@ -183,7 +183,7 @@ start_section() {
end_section() {
stop_section_spinner
if [[ $TRACK_SECTION -eq 1 && $SECTION_ACTIVITY -eq 0 ]]; then
if [[ "${TRACK_SECTION:-0}" == "1" && "${SECTION_ACTIVITY:-0}" == "0" ]]; then
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Nothing to clean"
fi
TRACK_SECTION=0
@@ -275,7 +275,7 @@ safe_clean() {
return 0
fi
if [[ $TRACK_SECTION -eq 1 && $SECTION_ACTIVITY -eq 0 ]]; then
if [[ "${TRACK_SECTION:-0}" == "1" && "${SECTION_ACTIVITY:-0}" == "0" ]]; then
stop_section_spinner
fi