delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/10/24/12:01:45

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
MIME-Version: 1.0
Subject: read -u how to
Date: Mon, 24 Oct 2005 18:01:40 +0200
Message-ID: <F05AFBF84C348C4AAF1A0E7D126E370A249AC6@exbn01.DPEB.DE>
From: cygwin DOT 20 DOT maillinglist AT spamgourmet DOT com
To: cygwin AT cygwin DOT com
X-Spamgourmet:
X-IsSubscribed: yes

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019