0

I'm currently cleaning up my server and had I look at a script which works and of whose existence I was aware of, but I can't figure out what's the reasoning behind the | [ "$VAR" ].

while read VAR || [ "$VAR" ]
do
    [...]
done < inputfile

Fun fact: I wrote this script a few years ago...

  • Cool. Make it an answer. – Max Ried Nov 9 at 11:44
  • 1
    I will pass. You answer if you wish. Give credit to the author of the linked answer, don't mention me. – Kamil Maciorowski Nov 9 at 12:05
  • I'd be slightly surprised if there is no SuperUser question that actually has this already. In any case, you're free to build upon my U&L answer if you wish. – Kusalananda Nov 9 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.