using ksh on an AIX 7.2 system
I have the following inputfile:
line1
line2
line3
I have the following code (rather simplified)
cat infile | while read strA ; do
echo "strA: $strA"
mail -s"check script strA: $strA" [email protected]
done
"mail" seems to read from STDIN, what stops the loop after the first line.
Result is:
line1
=>sending mail
When I let "mail" read from /dev/null, it works:
mail -s"check script strA: $strA" [email protected] </dev/null
BUT this way I get Warnings "No Message Body"
When I give a not empty dummyfile it also works`
mail -s"check script strA: $strA" [email protected] </tmp/anyexistingfile
BUT I do not want to send some rubbish
Is there another way to prevent reading from STDIN and exiting the loop?
Any secret mail-option? (I can't find some)
Thank you very much in advance
(hmmm ... took me 10 minutes to describe the problem and 20 minutes to format the text)