[CentOS] how to do repetetive command in shell

Roland RoLaNd r_o_l_a_n_d at hotmail.com
Thu Oct 21 14:45:16 EDT 2010

Dear all,

i'm writing a certain script which does a specific task in a repetitive manner, i'm going to give a similar script with the same concept hope you could advise me to a better way:


cp -r /opt/$USER1/test /backup/$USER1
cp -r /opt/$USER2/test /backup/$USER2

such a command would be repeated 832 times (this is just an example) 
so instead of copying the above line 832 times and appending that user's number in each "$USER"

is there a way to do it in a  smarter way ?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.centos.org/pipermail/centos/attachments/20101021/b27145b5/attachment.html 

More information about the CentOS mailing list