LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2004, 10:22 AM   #1
Cybercool
Member
 
Registered: Mar 2004
Location: Netherlands
Distribution: Debian kernel 2.4.xx
Posts: 36

Rep: Reputation: 15
Linux scripting


I want to make a script, that makes directory's en copy's files, when I execute it!!

My Linux distribution is Debian!!

Does anyone know how to set up a script like that??

(with "nano" or so"


Thanks

Cybercool
 
Old 04-06-2004, 10:43 AM   #2
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
Yes!!

It's something like this!!

#!/bin/sh
mkdir -p /path/to/new/directory
cp /name/of/file /new/destination/of/file

Isn't that easy??

Now, if you'd like more specific help, please explain a little more about what you mean by "makes directory's en copy's files".
 
Old 04-07-2004, 02:10 AM   #3
Cybercool
Member
 
Registered: Mar 2004
Location: Netherlands
Distribution: Debian kernel 2.4.xx
Posts: 36

Original Poster
Rep: Reputation: 15
And how do I run the script???

Does it need a special program??

Cybercool
 
Old 04-07-2004, 07:31 AM   #4
rob-n
LQ Newbie
 
Registered: Apr 2004
Location: in a garbage can
Distribution: Madrake10ce
Posts: 27

Rep: Reputation: 15
in terminal type sh yourscript or ./yourscript

but first cd into the dir of the script.
 
Old 04-07-2004, 08:13 AM   #5
verstapp
Member
 
Registered: Feb 2004
Location: canberra australia
Distribution: Suse 9.0
Posts: 44

Rep: Reputation: 15
You also have to type
chmod u+x <scriptname>
to make the script an executable file. You can most probably do this in your file browser window (in Suse konquerer: right-click on file, Properties menu option, permissions tab, click the user exec tickbox to put an X in there).

For anything else to do with scripting, start by typing 'bash tutorial' into google.
 
Old 04-16-2004, 01:57 AM   #6
rob-n
LQ Newbie
 
Registered: Apr 2004
Location: in a garbage can
Distribution: Madrake10ce
Posts: 27

Rep: Reputation: 15
to make things simpler, put your script in /usr/local/bin, and then you can run it as a command
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
linux scripting desheikh Linux - General 2 10-05-2005 05:45 AM
linux scripting help anirudh Programming 6 03-04-2005 10:33 PM
Scripting in Linux Rv5 Programming 2 09-05-2004 10:14 PM
Linux Scripting SainT1337 Linux - General 3 11-30-2003 01:12 PM
Linux Scripting atlight Linux - General 3 10-29-2003 08:11 AM


All times are GMT -5. The time now is 12:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration