Trying to pull an entry from two files (foofile, barfile) and pass them into a third file (dothis.sh) as arguments. It works for bar but not for foo since this looks be a scope related issue. I tried to nest the foo loop into the bar loop too with no success:
    #!/bin/bash
    while read foo
                do
                        #echo $foo
                        export foo
    done < FooFile
    while read bar
        do
                #echo $bar
                export bar
    ./dothis.sh $bar $foo
    done < BarFile

paste FooFile BarFile | xargs -n 2 ./dothis.sh???dothis.shfor each possible combination offooandbaror only combine them for the same line number? When you want each combination, movedone < FooFiletowards the end of the script (after the otherdone)