I have a prompt in my shell script where the user can choose a directory. I am trying to make it so that if a .gz file exists in that directory, they exit the loop, and if not, the user is asked again to choose a directory, but it just isn't working. Here's what I have so far:
ls -d */ while : do echo "Which Directory do you want to access?" read input_variable1 cd $input_variable1 if [ CHECK FOR .gz ] then break else ls -d */ echo "no .gz files to unzip. Try again." fi done