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

limit scope of variable



I have a function that requires this:

    local IFS=$'\n'

... but the function calls other functions in which I need to protect $IFS from that change.  Can I limit the scope?  As it is I'm laboring it with this:

In the calling function:

     local OLDIFS="$IFS"
     local IFS=$'\n'

In the called function:

    IFS=$OLDIFS

    code ...
    code ...

    IFS=$'\n'
    return

... there's got to be a more streamlined way.





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