Reputation: 31313
I am using curl from a BASH shell. I would like to create a text file of commands to send via curl and then somehow have all of them run at once. It's been a long time since I dealt with UNIX commands, but can someone show me how to accomplish this please (assuming I have a file created called commands.txt)?
Editing this post to include an example of the file of commands I would like to execute in batch...
curl -XPUT 'http://localhost:9200/foo/property/1' -d '{"firstName":"Domino","lastName":"Derval"}'
curl -XPUT 'http://localhost:9200/foo/property/2' -d '{"firstName":"Elektra","lastName":"King"}'
curl -XPUT 'http://localhost:9200/foo/property/3' -d '{"firstName":"Fiona","lastName":"Volpe"}'
curl -XPUT 'http://localhost:9200/foo/property/4' -d '{"firstName":"Holly","lastName":"Goodhead"}'
curl -XPUT 'http://localhost:9200/foo/property/5' -d '{"firstName":"Honey","lastName":"Rider"}'
curl -XPUT 'http://localhost:9200/foo/property/6' -d '{"firstName":"Jill","lastName":"Masterton"}'
curl -XPUT 'http://localhost:9200/foo/property/7' -d '{"firstName":"Kissy","lastName":"Suzuki"}'
curl -XPUT 'http://localhost:9200/foo/property/8' -d '{"firstName":"Mary","lastName":"Goodnight"}'
curl -XPUT 'http://localhost:9200/foo/property/9' -d '{"firstName":"Miranda","lastName":"Frost"}'
curl -XPUT 'http://localhost:9200/foo/property/10' -d '{"firstName":"Molly","lastName":"Warmflash"}'
curl -XPUT 'http://localhost:9200/foo/property/11' -d '{"firstName":"Paula","lastName":"Caplan"}'
curl -XPUT 'http://localhost:9200/foo/property/12' -d '{"firstName":"Penelope","lastName":"Smallbone"}'
curl -XPUT 'http://localhost:9200/foo/property/13' -d '{"firstName":"Pussy","lastName":"Galore"}'
curl -XPUT 'http://localhost:9200/foo/property/14' -d '{"firstName":"Strawberry","lastName":"Fields"}'
curl -XPUT 'http://localhost:9200/foo/property/15' -d '{"firstName":"Sylvia","lastName":"Trench"}'
curl -XPUT 'http://localhost:9200/foo/property/16' -d '{"firstName":"Tatiana","lastName":"Romanova"}'
curl -XPUT 'http://localhost:9200/foo/property/17' -d '{"firstName":"Tilly","lastName":"Masterton"}'
curl -XPUT 'http://localhost:9200/foo/property/18' -d '{"firstName":"Vesper","lastName":"Lynd"}'
curl -XPUT 'http://localhost:9200/foo/property/19' -d '{"firstName":"Xenia","lastName":"Onatopp"}'
Upvotes: 2
Views: 10090
Reputation: 161604
download.sh
#!/bin/bash
# put all your commands here
curl ...
.
.
.
curl ...
download.sh
executable$ chmod +x download.sh
donwload.sh
$ ./download.sh
Upvotes: 13