In a shell script, if I specify directly the text file, it works:
#!/bin/bash
IFS=''
while read input <&3 && read output <&4; do
echo "$input -----> $output"
done 3<inputfile.txt 4<outputfile.txt #This line works
However, when I try to make the script accept arguments (./myscript.sh inputfile.txt outputfile.txt
), there's nothing echoed:
#!/bin/bash
fromtxt="$1"
totext="$2"
IFS=''
while read input <&3 && read output <&4; do
echo "$input -----> $output"
done 3<"$fromtxt" 4<"$totext" #This line doesn't
What's my mistake?