0

I have an application which is modularised like this:

`APP
    PART1
       part1.sh
    PART2
       part2.o
    PART3
       part3.o`

Input file for part1.o generates a output file that is again input file for part2.o, which generates another file, which is input for part3.o and finally the output for overall app.

I'm intending to have a run.sh file that should take the first input file for the sub-application (part1) and so and forth trigger the rest of the sub-applications and store the last output in a file name, mentioned with command. Something like this:

run.sh input.txt output.txt

Currently my shell looks like this:

OUTPUT1="output1.txt"
OUTPUT2="output2.txt"
./PART1/part1.sh  $0 > OUTPUT1 &&
./PART2/part2.o < OUTPUT1 > OUTPUT2 &&
./PART3/part3.o < OUTPUT2 > $1

Currently, if I run this code, I get the following output indefinitely long:

+ ./run.sh
+ ./run.sh
+ ./run.sh
.
.
.
.

Can anyone help me with this? What am I doing wrong?

kishoredbn
  • 2,007
  • 4
  • 28
  • 47

1 Answers1

2

You are using positional parameters incorrectly.

run.sh input.txt output.txt

will populate positional params with values given below

$0 = run.sh

$1 = input.txt

$2 = output.txt

More on positional params

ppp
  • 975
  • 7
  • 15