Damn...I will get this right...Need more sleep...<div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">for i in `ls -d /opt/* | cut -d/ -f3`<div class="im" style="color: rgb(102, 102, 102); ">

<div><div>do</div><div>cp /opt/${i}/test/ /backup/${i}</div><div>done</div></div></div></span><div><br></div><div>I KNOW this one will work...If not, I quit!!!</div><div>John</div><div><br></div><div><br><div class="gmail_quote">

On Thu, Oct 21, 2010 at 14:55, John Kennedy <span dir="ltr"><<a href="mailto:skebi69@gmail.com">skebi69@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Not quite right...<div><br></div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">for i in `ls -d /opt | cut -d/ -f2`<div class="im"><div><div>do</div><div>cp /opt/${i}/test/ /backup/${i}</div>


<div>done</div></div><div><br></div></div><div>Takes out the /opt/ from my first try...</div><div>John</div></span><div><div></div><div class="h5"><br><div class="gmail_quote">On Thu, Oct 21, 2010 at 14:51, John Kennedy <span dir="ltr"><<a href="mailto:skebi69@gmail.com" target="_blank">skebi69@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">for i in `ls -d /opt`<div><div>do</div><div>cp /opt/${i}/test/ /backup/${i}</div><div>done</div><div><br><br><div class="gmail_quote">


<div><div></div><div>On Thu, Oct 21, 2010 at 14:45, Roland RoLaNd <span dir="ltr"><<a href="mailto:r_o_l_a_n_d@hotmail.com" target="_blank">r_o_l_a_n_d@hotmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>



<div>
Dear all,<br><br>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:<br><br><br>USER1="roland"<br>



USER2="dany"<br>USER3="kevin"<br><br><br>cp -r /opt/$USER1/test /backup/$USER1<br>cp -r /opt/$USER2/test /backup/$USER2<br><br><br>such a command would be repeated 832 times (this is just an example) <br>



so instead of copying the above line 832 times and appending that user's number in each "$USER"<br><br>is there a way to do it in a  smarter way ?<br><br><br>thanks,<br><br>--Rolad<br><br>                                          </div>



<br></div></div><div>_______________________________________________<br>
CentOS mailing list<br>
<a href="mailto:CentOS@centos.org" target="_blank">CentOS@centos.org</a><br>
<a href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">http://lists.centos.org/mailman/listinfo/centos</a><br>
<br></div></blockquote></div><br><br clear="all"><br>-- <br> John Kennedy<br><br>
</div></div>
</blockquote></div><br><br clear="all"><br></div></div>-- <br> John Kennedy<br><br>
</div>
</blockquote></div><br><br clear="all"><br>-- <br> John Kennedy<br><br>
</div></div>