I have following part of code inside bash script.
for dir in $(find /etc/aaa -type d -maxdepth 1) do #my code done #my code
/etc/aaa directory is not present then i want to exit script with some error.
I am aware that i can test existence of directory before executing for loop.
But i want to know is there any other way (short way in for loop only) so that if directory
/etc/aaa is not present then it should exit else script should continue.
In current situation, script give error of that
find: /etc/aaa: No such file or directory and continues to remaining part after for loop.
Also exit status of for loop is 0.