Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: avoid eval?



On 03/12/2018 10:13 PM, Ray Andrews wrote:
> On 11/03/18 05:43 PM, Ray Andrews wrote:
>> On 11/03/18 03:53 PM, Marc Chantreux wrote:
>>> "$@" expands as an array and "$*" expands as a string so
>>> func () cp oldfile "$*"
>>>
>>>
>> Thanks so it does.  I tried that and 50 other ideas.  I just now realized it was because I had $IFS=$'\n'
>>
>> set in another function :-(  Cost me half the day.
>>
> Is there any way to immunize my functions against $IFS trouble?  I have functions that seem to require " $IFS=$'\n' " and others that insist on " $IFS=' '  ".  It would be nice if I didn't have to reset it in each function.  I'll bet there will be syntax
> that always does the right thing regardless of $IFS.
> 
> 

In the 10 or so years that i have used zsh, i've never needed to change IFS. but in the functions that you think that you need to change IFS,
you would just use local to scope the change to that function.



Messages sorted by: Reverse Date, Date, Thread, Author