redirecting stdin in ksh
Doug Gwyn <gwyn>
gwyn at brl-tgr.ARPA
Mon Jan 20 09:54:00 AEST 1986
> exec 3<&0 < file # dup stdin to fd 3, and redirect from file
> while [ "$more" ]
> do
> read number age name
> if [ "$?" -eq 0 ]
> then
> process number, age, name
> else # end of file
> more=""
> fi
> done
> exec 0<&3 3<&- # redirect stdin back to fd 0, close fd 3
My guess is that ksh closed down all fds other than 0,1,2
when execing a command inside the loop.
More information about the Comp.unix
mailing list