zsh-users
 help / color / mirror / code / Atom feed
* limit scope of variable
@ 2021-08-03 20:15 Ray Andrews
  2021-08-03 20:39 ` Bart Schaefer
  2021-08-03 20:41 ` Vin Shelton
  0 siblings, 2 replies; 5+ messages in thread
From: Ray Andrews @ 2021-08-03 20:15 UTC (permalink / raw)
  To: Zsh Users

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.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-04  0:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 20:15 limit scope of variable Ray Andrews
2021-08-03 20:39 ` Bart Schaefer
2021-08-04  0:09   ` Ray Andrews
2021-08-03 20:41 ` Vin Shelton
2021-08-03 20:44   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).