LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-14-2011, 10:57 PM   #1
sushil.cool
LQ Newbie
 
Registered: Mar 2010
Posts: 15

Rep: Reputation: 0
Help required in shell scripting


I have a command which takes 2 input to run


like

moshell/mobatch -t 240 - [first file1] [first file2]

my concern is that we have n number of first file1 and first file2.
and i have to run this batch one file after other ,i have put the above two required files [first file1] &[first file2]
in two different folder's
Now please help me in getting one file after other as input to my batch .


Kindly reply
 
Old 12-14-2011, 11:56 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,544

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
What environment are you in? Is this a Windows batch script or a linux bash (or other shell) requirement?
 
Old 12-15-2011, 12:23 AM   #3
sushil.cool
LQ Newbie
 
Registered: Mar 2010
Posts: 15

Original Poster
Rep: Reputation: 0
environment is sun solaris
 
Old 12-15-2011, 12:26 AM   #4
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 210Reputation: 210Reputation: 210
woops wrong post
 
Old 12-15-2011, 12:59 AM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,544

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
So would you expand on your explanation? What are you struggling to do? Finding files for a sh script and providing them
to your function would seem to be a fairly trivial task.
 
Old 12-15-2011, 01:21 AM   #6
sushil.cool
LQ Newbie
 
Registered: Mar 2010
Posts: 15

Original Poster
Rep: Reputation: 0
I am struggling in getting the script or code ,so that i can implement whatever i required in post .

moshell/mobatch -t 240 - [first file1] [first file2]
[first file1]contains n files

[first file2]contains n files


i have to pick one file each from these two one after other.
 
Old 12-15-2011, 01:27 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
The requirement is not clear. Does "first file1" (file1?) contain a list of file paths and similar for file2? Do you want to loop over the files listed file1 and file2 simultaneously, doing something with the file path read from file1 and the file path read from file2?
 
Old 12-15-2011, 09:21 AM   #8
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,826

Rep: Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973
It would also help if you provided actual examples of the directories and file names, rather than this vague "file1" type stuff.

In addition, please explain exactly how the files should be ordered when the commands run. Do they have to be matched up by file name, or by directory position, or what?

Finally, please post any actual code you've already tried, to help us better understand your goal and your exact level of ability.

And please use [code][/code] tags around your code and data, to preserve formatting and to improve readability.


The best solution is probably simply to load the files from the directories into arrays, with matched index numbers, and run a simple loop over the values of the indexes. But again, we need more details first.
 
  


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
Need scripting help configuring raw data into required format (perl or shell) vamsiv Linux - Newbie 8 09-28-2011 09:02 PM
Help Required With Shell Scripting bigbadbo Programming 4 03-20-2007 05:30 AM
Help Required With Shell Scripting bigbadbo Linux - General 3 03-19-2007 07:11 PM
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 04:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:26 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