Quote:
Originally Posted by stepk
Define as local what for? I mean what's your concern if it isn't defined as local? IFS is a special shell variable, local or global it affects the way sh works. Note that json_parse sets it the resets to its default value when it's finished.
|
1) Keeps the changes to IFS local to the function ;
2) Does not assume an error-free code path ;
3) Is a matter of good style ;
4) You can drop that "resets it to the default value" thing ;
4.a) Which might be an error - a function can't be certain it was set to the default value on entry ;
4.b) The value of IFS will be the same on exit as on entry.