Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> Noob needs help with script
Yaesu
post Apr 25 2013, 09:21 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 25-April 13
Member No.: 18,231



I need to create a script that will check to see if a file exists and if it does then make 10 copies of itself with an appended name in another directory. This is what I have but its not working. I got the error message to work but I cant even get it to make one copy of itself. if i use a known file it still gives me an error message that I created. Can someone check this out for me.

CODE
#!/bin/sh

if [ $1 -e ]
     then
         N=1
         while [$N -le 10 ]
     do
         cp $1 $2
     done
          
     else
         echo File does not exist.
     fi
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
michaelk
post Apr 27 2013, 08:56 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,797
Joined: 23-January 03
Member No.: 360



I assume this is homework. Have you tried searching the web for help with bash programming?

/www.cyberciti.biz/faq/bash-while-loop/

Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st October 2017 - 03:46 AM