On Fri, 5 Aug 2011, Steven W. Orr wrote:
One trick that bit me a while back, is that the order of declaring IFS and
old_IFS is important. It has to be done in this order:
foo()
{
typeset -r old_IFS="$IFS" # Must come first
typeset IFS
stuff...
}
I always use local and don't change it back within a function:
foo()
{
local IFS=bar
: whatever
}
The original value is not changed in the calling script.
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)