[CentOS] how to do repetetive command in shell

Pintér Tibor tibyke at tibyke.hu
Thu Oct 21 18:50:23 UTC 2010


> USER1="roland"
> USER2="dany"
> USER3="kevin"
> 
> 
> cp -r /opt/$USER1/test /backup/$USER1
> cp -r /opt/$USER2/test /backup/$USER2

$ for user in one two three four; do echo $user; done
one
two
three
four

t



More information about the CentOS mailing list