View Single Post
Old 01-22-2013, 09:16 AM   #97
stepk
Groupie
stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.
 
Posts: 165
Karma: 593460
Join Date: Oct 2012
Device: K5 B011 5.3.2.1
Quote:
Originally Posted by knc1 View Post
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
stepk is offline   Reply With Quote