1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-08 17:54:20 +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

@@ -569,7 +569,7 @@ start_section() {
# End a section
# Shows "Nothing to tidy" if no activity was recorded
end_section() {
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 tidy"
fi
TRACK_SECTION=0
@@ -577,7 +577,7 @@ end_section() {
# Mark activity in current section
note_activity() {
if [[ $TRACK_SECTION -eq 1 ]]; then
if [[ "${TRACK_SECTION:-0}" == "1" ]]; then
SECTION_ACTIVITY=1
fi
}