LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help required in shell scripting (https://www.linuxquestions.org/questions/linux-newbie-8/help-required-in-shell-scripting-918800/)

sushil.cool 12-14-2011 10:57 PM

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

grail 12-14-2011 11:56 PM

What environment are you in? Is this a Windows batch script or a linux bash (or other shell) requirement?

sushil.cool 12-15-2011 12:23 AM

environment is sun solaris

jhwilliams 12-15-2011 12:26 AM

woops wrong post

grail 12-15-2011 12:59 AM

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.

sushil.cool 12-15-2011 01:21 AM

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.

catkin 12-15-2011 01:27 AM

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?

David the H. 12-15-2011 09:21 AM

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.


All times are GMT -5. The time now is 04:38 PM.