I am writing this script that have this line:ls -lrt /dir1/dir2/filename*.txt | tail -1 | awk '{print $9}' | read variableWhat I wanted is to exit the script (without using if-statement) if it does not find any match.
exit a script if an ls line did not find any match
shell script;ls;exit