From 52d550c2b3b5037fba32c6e8948dcd131f91615d Mon Sep 17 00:00:00 2001 From: ketumbra <80352736+ketumbra@users.noreply.github.com> Date: Fri, 30 Sep 2022 22:20:59 +0100 Subject: [PATCH] check outfile exists first and use stat for size check Co-authored-by: packetzero <20775507+packetzero@users.noreply.github.com> --- atomics/T1123/src/T1123.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/atomics/T1123/src/T1123.sh b/atomics/T1123/src/T1123.sh index ac9232da..75b78145 100644 --- a/atomics/T1123/src/T1123.sh +++ b/atomics/T1123/src/T1123.sh @@ -24,9 +24,11 @@ osascript -e ' ' "${OUTPATH}" ${DURSEC} # check file is created and a decent size (empty recording is still ~62KB) -RECSIZE=`cat ${OUTPATH} | wc -c` -if [ $RECSIZE -gt 100000 ]; then - echo "Audio data present" && exit 0 +if [ -f "${OUTPATH}" ] ; then + RECSIZE=`stat -f '%z' ${OUTPATH}` + if [ $RECSIZE -gt 100000 ]; then + echo "Audio data present" && exit 0 + fi fi echo "Failed" exit 1 \ No newline at end of file