Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 04-19-2012, 01:21 AM   #1
LQ Newbie
Registered: Apr 2012
Posts: 20

Rep: Reputation: Disabled
positional parameters script making

I was going to make some script file that must coping one folder(for example: /home/movies/terminator2) to another(that another folder must be parameter )
please help.
Old 04-19-2012, 01:24 AM   #2
LQ Veteran
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
Hi and welcome to LQ,

Is there a question somewhere? We are more then willing to help, but we don't do all the work for you.

What have you tried? What did or did not work?
Old 04-19-2012, 09:13 PM   #3
LQ Newbie
Registered: Oct 2010
Posts: 6

Rep: Reputation: 0

I'm not sure whether you want to copy the directory and its contents, or just its contents. But here's a script to get you started. It addresses both cases.

The directory "thisdir" has a file in it, but "thatdir" is an empty directory
This script,, takes one parameter, $1. The 1st copy will copy just the contents of thisdir, not the directory structure itself. The 2nd copy copies the entire thisdir directory--with its contents-- to thatdir.

Here's the script
#copy the contents of -thisdir- to -thatdir-
cp -t $1 thisdir/*.*
#copy the directory -thisdir- into -thatdir
cp -r thisdir $1
echo "the contents of -thisdir- and the directory now in -$1-"

After creating it, invoke by keying in;
./ thatdir
I'm using "thatdir" as the parameter, but you can create/use your own directories.

Note that you have to enable the execution of with
chmod +x

Here are some links you might find useful:

Linux Commands
Shell Script Beginners Handbook
Bash Scripting Tutorial

Hope this helps. It's always tough for a newbie.

Last edited by RootAround; 04-19-2012 at 09:17 PM.


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
perl positional parameters/ casperdaghost Programming 6 11-11-2011 01:08 AM
HELP! Positional Parameters are giving me a headache! Scott_82 Linux - Newbie 7 05-06-2007 03:32 PM
shell: positional parameters... neidias Programming 1 04-04-2005 02:45 PM
Positional Parameters (arguments) desbyleo Solaris / OpenSolaris 2 10-25-2004 11:51 AM
Help with positional parameters Read_Icculus Linux - General 7 11-02-2003 04:23 AM > Forums > Linux Forums > Linux - Newbie

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

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