sh scripting question

Manish Jain bourne.identity at hotmail.com
Fri Oct 16 02:48:34 UTC 2020



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


More information about the freebsd-questions mailing list