Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Oct 2020 08:10:07 +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:  <DB8PR06MB6442CC457CB497121B2B4E1AF6030@DB8PR06MB6442.eurprd06.prod.outlook.com>
In-Reply-To: <3aab3608-c9be-a944-77a4-6d0e3ac34c5b@hotmail.com>
References:  <24456.60388.135834.43951@jerusalem.litteratus.org> <DB8PR06MB64424A22725BA519978C0806F6030@DB8PR06MB6442.eurprd06.prod.outlook.com> <24456.61612.942942.811357@jerusalem.litteratus.org> <3aab3608-c9be-a944-77a4-6d0e3ac34c5b@hotmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Corrections: the backslash on the third line is wrong:

 > oldifs="$IFS"
 > IFS=$’\n’
 > for f in "`cat files.list`" \
 > #stuff
 > done
 > IFS="$oldifs"


So that should be :

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


Sorry for the typo,
Manish Jain



On 2020-10-16 08:02, Manish Jain wrote:
> 
> 
> 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?DB8PR06MB6442CC457CB497121B2B4E1AF6030>