delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/11/29/11:51:29

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RP_MATCHES_RCVD,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
Mail-Followup-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
From: Gary <listgj-cygwin AT yahoo DOT co DOT uk>
Subject: Re: Shell script - is this expected behaviour?
Date: Tue, 29 Nov 2011 17:50:45 +0100
Lines: 21
Message-ID: <jb32h6$qae$1@dough.gmane.org>
References: <jb26vu$5tc$1 AT dough DOT gmane DOT org> <4ED4F78D DOT 303 AT redhat DOT com>
Mime-Version: 1.0
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (cygwin)
X-No-Archive: Yes
Mail-Copies-To: never
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

Eric Blake wrote:
> On 11/29/2011 02:00 AM, Gary wrote:
>> If I have a shell script which reads a file which does not have an end
>> of line character at the end if it's only line, it does not read
>> anything.
>
> Not cygwin specific.

Okay, thanks. That's what I was wondering.

>> If it's expected behaviour, what's the workaround?
>
> Never feed 'read' unterminated input.  Always end your text files with a
> newline.

Yeah, sadly the input file isn't under my control. I ended up just
stuffing a newline on the end regardless. I would read the file first to
find out if it was necessary, but...

-- 
Gary        Please do NOT send me 'courtesy' replies off-list.


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

- Raw text -


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