Quote:
Originally Posted by knc1
That is exactly what:
local IFS
does for you - no need to add any executable statements.
|
I didn't explain myself exactly. json_parse calls a user-provided function - make_label in this case. I want for the user-provided function to get an unmodified IFS. So I need to reset IFS before calling the user's function from within json_parse, don't I?
Code:
json_parse() {
local IFS0=$IFS IFS ... foo=$2
...
IFS=,
...
IFS=$IFS0
$foo
...
}
or is the local scoping not affecting called subs?
Also is it safe to save $IFS and declare it local in a single statement, or should I break it into two lines
Code:
local IFS0=$IFS
local IFS ...
thanks