cc: [email protected]
Subject: Re: [ast-users] Function readfile in ksh
--------

> I would like to reproduce here a function by David Korn:
> 
> ==================cut here============================
> function readfile # var file
> {
>         nameref var=$1
>         set -f
>         IFS=$'\n\n'
>         var=( $(< $2))
> }
> ==================cut here============================
> 
> I presume that [set -f] (disable file name generation) is locally scoped, but 
> wh
> at about the assignment to IFS? It seems to me that IFS is globally scoped 
> here,
>  hence that assigment would most likey have bad side effects on the caller 
> code.
> 

You are correct.  The line
         IFS=$'\n\n'
should be
         typeset IFS=$'\n\n'
which creates a local IFS for that function.

David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to