Wednesday, October 7, 2009

/bin/bash infinite loop oneliner

How to run a command in a loop as a one liner. I always get confused with the semi-colons and dones...
while (true) do curl  http://sspq1/cgi-bin/spologin.pl -d "username=x-1&password=fxxx&login=LOGIN"; done;

while (true) do perl msdash.pl -e QAS -a PDI-Cluster -r gss 2> /dev/null | grep get; done;
For a for in do loop the syntax for the one liner looks like this with an extra semi colon after the for statement declaration.
for i in {1..15}; do wget http://www.hairuwear.com/sites/all/themes/hairuwear/images/slide$i.jpg; done;

No comments:

Post a Comment