Skip to content

Commit ce90a01

Browse files
committed
improve: suffix selection clarity on post-fs-data.sh
Now the exclusions are explicitly shown in the if statement instead of relying on it being false covers an edge-case where a file is added manually with suffix higher than 3 making it add new logs forever instead of overwriting the first one and starting again Signed-off-by: TheSillyOk <priv.ld@proton.me>
1 parent 85c5048 commit ce90a01

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

post-fs-data.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ watch_dmesg() {
4040
}
4141

4242
LATEST_SUFFIX=$(basename $(ls -t "$SAVE_FOLDER"/DebugAssistant*.log | grep -v "Redacted" | head -n 1) | grep -oE "([0-9]+)?")
43-
if [[ -f "$SAVE_FOLDER/DebugAssistant.log" && "$LATEST_SUFFIX" != "3" ]]; then
44-
SUFFIX="-$(( ${LATEST_SUFFIX:-1} + 1 ))"
45-
else
43+
if [[ -z "$(ls $SAVE_FOLDER/DebugAssistant*.log)" || "${LATEST_SUFFIX:-1}" -ge 3 ]]; then
4644
SUFFIX=""
45+
else
46+
SUFFIX="-$(( ${LATEST_SUFFIX:-1} + 1 ))"
4747
fi
4848

4949
start_log "$SUFFIX"

0 commit comments

Comments
 (0)