This is my code:
while IFS=',' read a b c; do read input echo $input done 3<&0 < input.csv > output.txt
I took care of input redirection by redirecting through pipeline. But still,when I run the above code, control does not stop for input.
Why?
It's because your input stream is feeding both read
. You're almost right, so maybe it's a typo (you just forgot to give to right FD to your second read
) :
while IFS=',' read a b c; do read input <&3 echo $input done 3<&0 < input.csv >> output.txt
read input <&3
by my_function <&3
and it should work.