I need to check if a file with a specific extension exists and if it is not empty. The problem is that I don't know the name of the file, just the extension and the path.
Here my solution with an known name
FILE="/Users/test/my.out"
if [[ -f $FILE && -s $FILE ]] ; then echo "EXIST"; fi
Using
FILE="/Users/test/*.out"
Do not work
FILE=$(ls /Users/test/*.out)