syntax error near unexpected token `<'

Viewed 23240
StudentAnwser=()
inputScriptFile=001.sh

while IFS= read -r line;
do
    StudentAnwser+=( "$line" )
done < <( sh $inputScriptFile test.txt )

it returns a error

foo.sh: line 22: syntax error near unexpected token `<'
foo.sh: line 22: `  done < <( sh $inputScriptFile test.txt )'

what's wrong with that? I follow the solution from other question for reading line from result

2 Answers

Found another solution: process substitution is not a POSIX-compliant feature and, depending on your system and shell, it might need to be enabled.

Use the following line in your script, before the loop:

set +o posix

to enable it. It might be that your system doesn't support it at all, then this is of no help.

Related