My shell script, It executes its inner loop correctly, but only execute its outer loop once.
Please kindly check my script, why it does not work.
OS: Amazon EC2 Linux
I created shell script, to delete files, from a directory, with filenames, that are not exist in my created TXT file.
for entry in "/home/ec2-user/upload/upload/*"
do
exist=false
file="/home/ec2-user/upload/requiredjpg.txt"
while IFS= read -r line
do
if [ "$line" = "$entry" ]
then
echo "same"
else
echo "not same"
fi
done <"$file"
echo $exist
if [ $exist = false ]
then
echo $exist
fi
done