Reputation: 5368
I want to run a bash command once for each line of a text file.
If I do:
while read l; do
echo $l;
done < myfile.txt
I get each line echoed.
But when I use my actual command:
while read l; do
curl -X POST http://somedomain -H "Content-Type: application/json" -d $l
done < myfile.txt
I get errors. I think it may have something to do with escaping characters in the text file, but nothing I have tried works. What is the proper way to run a curl expression once for each line of a text file?
Upvotes: 0
Views: 395