Computing.Net > Forums > Unix > Bourne shell script,Unix

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Bourne shell script,Unix

Reply to Message Icon

Name: Sonyas
Date: July 26, 2003 at 23:21:56 Pacific
OS: 2000
CPU/Ram: 256
Comment:

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.




Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: July 27, 2003 at 05:54:27 Pacific
Reply:

Sounds like homework, why don't you show us what you have so far. How about the 'while' version.


0

Response Number 2
Name: Sonyas
Date: July 28, 2003 at 21:50:28 Pacific
Reply:

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$FILE

I 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$FILE

this 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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Bourne shell script,Unix

Bourne Shell script www.computing.net/answers/unix/bourne-shell-script-/2883.html

Write a Bourne Shell Script--help! www.computing.net/answers/unix/write-a-bourne-shell-scripthelp/2055.html

Bourne shell script www.computing.net/answers/unix/bourne-shell-script/4316.html