Reputation: 1211
I'm not meaning multiple conditions, well it's also but mixed from that:
while [[ read line ] && [ "$GoodURL" == "false" ]]
What is the correct form for that? It's a while loop that runs on a text file line by line,
and I want to stop it with that $GoodURL
type of boolean, please help.
Thanks.
Upvotes: 3
Views: 7057
Reputation: 392833
while read line && [[ "$GoodURL" == "false" ]]
do
echo $line;
done
In case you want to read from a file/pipe, be sure to use indirection or you will get funny results (due the while loop executing in a subshell and not actually using the same environmen as the surrounding shell)
while read line && [[ "$GoodURL" == "false" ]]
do
echo $line;
done < input.txt
Upvotes: 6