Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
limit scope of variable
- X-seq: zsh-users 26844
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: limit scope of variable
- Date: Tue, 3 Aug 2021 13:15:03 -0700
- Archived-at: <https://zsh.org/users/26844>
- List-id: <zsh-users.zsh.org>
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