From 22a64a3e8983fad8c7bb02b66114ae60966ab8ed Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 4 Mar 2015 17:09:01 -0700 Subject: [PATCH] Delete empty log files This prevents "bashbrew/logs/latest/list-.....". --- bashbrew.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bashbrew.sh b/bashbrew.sh index 54a46ee..d952541 100755 --- a/bashbrew.sh +++ b/bashbrew.sh @@ -270,7 +270,8 @@ while [ "$#" -gt 0 ]; do thisLog="$logDir/$subcommand-$repoTag.log" touch "$thisLog" - ln -sf "$thisLog" "$latestLogDir/$(basename "$thisLog")" + thisLogSymlink="$latestLogDir/$(basename "$thisLog")" + ln -sf "$thisLog" "$thisLogSymlink" case "$subcommand" in build) @@ -373,6 +374,10 @@ while [ "$#" -gt 0 ]; do done ;; esac + + if [ ! -s "$thisLog" ]; then + rm "$thisLog" "$thisLogSymlink" + fi done [ -z "$didFail" ]