read -u how to

cygwin.20.maillinglist@spamgourmet.com cygwin.20.maillinglist@spamgourmet.com
Mon Oct 24 16:01:00 GMT 2005


Hi folks 

I have the problem that I like to use read -u to read from file. 
The following script was stored under $HOME/bin/h 
----------------------------------
#!/bin/bash
set -xv
ls -l $HOME/bin/h
3<$HOME/bin/h

while read -u 3 
do
  echo $REPLY
done
----------------------------------
The output of a run is 

----------------------------------
ls -l $HOME/bin/h
 3:  ls -l /cygdrive/c/home/bin/h
-rwx------+ 1 F.Braunbeck Domänen-Benutzer 101 Oct 24 17:52 /cygdrive/c/home/bin/h
3<$HOME/bin/h

while read -u 3
do
  echo $REPLY
done
 6:  read -u 3
/cygdrive/c/home/bin/h: line 6: read: 3: invalid file descriptor: Bad file descriptor
---------------------------------

How can I get it work so that no "Bad file descriptor" error comes out

IMPORTANT
I will read replies only from the mailing list. 
If you send me email directly it will be deleted.

Regards 

    Franz


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list