Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Oct 2020 08:02:41 +0530
From:      Manish Jain <bourne.identity@hotmail.com>
To:        Robert Huff <roberthuff@rcn.com>, FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: sh scripting question
Message-ID:  <DB8PR06MB6442BCC6D778BC787D32F12DF6030@DB8PR06MB6442.eurprd06.prod.outlook.com>
In-Reply-To: <24456.61612.942942.811357@jerusalem.litteratus.org>
References:  <24456.60388.135834.43951@jerusalem.litteratus.org> <DB8PR06MB64424A22725BA519978C0806F6030@DB8PR06MB6442.eurprd06.prod.outlook.com> <24456.61612.942942.811357@jerusalem.litteratus.org>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help


On 2020-10-16 06:30, Robert Huff wrote:
> 
> Hello:
> 
>>    Try :
>>    
>>    for FILE in "`cat files.list`"
> 
> 	That's better ... but sets FILE to the entire content of
> files.list.
> 	I'm trying to pick off one line at a time for further processing.
> 	(I feel like I've done this before - successfully - and for some
> reason now it's not working.  <Grrrrrr!>)

Hi Huff,


You have to set/reset IFS :

oldifs="$IFS"
IFS=$ā€™\nā€™
for f in "`cat files.list`" \
#stuff
done
IFS="$oldifs"

Regards,
Manish Jain



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?DB8PR06MB6442BCC6D778BC787D32F12DF6030>