On Thu, Sep 25, 2014 at 02:50:03PM +0100, Jason Vas Dias wrote: > But now there is an issue - bash seems to lose its idea of stdout / stderr > being > a terminal within read loops, as illustrated by this test script (/tmp/t.sh): > > <quote> > #!/bin/bash > tty > echo $'1\n2' > test.list; > while read line; do > tty; > done < test.list > </quote>
Well, that's because you have redirected stdin. Try this instead: while read line <&3; do tty done 3< test.list