Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I need heeelp. please
I am stuck writing a "loop" script that will ask a user for a file name , then copy the file 5 times automatically, and the destination names have to be the same as the foriginal file name but with 1,2,3, etc. added( cp file to file1 file2, file3, etc.)
I used "for, while until,and case" still cant get it to work. pleease heelp.

Thanks for the reply; however, there is no need for help any more. I actually did it, and I felt like a stupid A** for not realizing what I was doing wrong because it was getting late 2 am, and I had a brain freez; nevertheless, and for the benefit of other begenners like my self, here is what I did wrong:
read FILE
for FILE in 1 2 3 4
do
cp $FILE $FILE$FILEI know sooo stupid, you see the "read" var. was supposed to be "file" not "FILE", and the it will look like this:
read file
for FILE in 1 2 3 4
do
cp $file $file$FILEthis is just part of the script, but it was the part that I messed up.
any way thanks again, and if you are trying to tell me that "while" can do this, I'll love to know how, I just can't see it.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |