From f7b9056e694932e63990a1e512d52c9e489db493 Mon Sep 17 00:00:00 2001 From: Parker Mossman Date: Fri, 21 Oct 2022 11:34:47 -0700 Subject: [PATCH] only rm file if it exists (#18310) --- tools/bin/load_test/cleanup_load_test.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/bin/load_test/cleanup_load_test.sh b/tools/bin/load_test/cleanup_load_test.sh index 49e339944bea..8394efddff48 100755 --- a/tools/bin/load_test/cleanup_load_test.sh +++ b/tools/bin/load_test/cleanup_load_test.sh @@ -92,7 +92,8 @@ function deleteConnections { removeFirstLineFromFile $CONNECTION_CLEANUP_FILE done - if ! test -s $CONNECTION_CLEANUP_FILE + # if file exists and is empty + if test -e $CONNECTION_CLEANUP_FILE && ! test -s $CONNECTION_CLEANUP_FILE then rm $CONNECTION_CLEANUP_FILE echo "removed cleanup file $CONNECTION_CLEANUP_FILE" @@ -110,7 +111,8 @@ function deleteSources { removeFirstLineFromFile $SOURCE_CLEANUP_FILE done - if ! test -s $SOURCE_CLEANUP_FILE + # if file exists and is empty + if test -e $SOURCE_CLEANUP_FILE && ! test -s $SOURCE_CLEANUP_FILE then rm $SOURCE_CLEANUP_FILE echo "removed cleanup file $SOURCE_CLEANUP_FILE" @@ -128,7 +130,8 @@ function deleteDestinations { removeFirstLineFromFile $DESTINATION_CLEANUP_FILE done - if test -z $DESTINATION_CLEANUP_FILE + # if file exists and is empty + if test -e $DESTINATION_CLEANUP_FILE && ! test -s $DESTINATION_CLEANUP_FILE then rm $DESTINATION_CLEANUP_FILE echo "removed cleanup file $DESTINATION_CLEANUP_FILE"