Subject: Different behavior w/ and w/o local
To: None <>
From: Julio M. Merino Vidal <>
List: tech-userlevel
Date: 09/14/2003 10:39:23
Hi all,

consider the following two shell functions:

f1() {
	echo $var

f2() {
	local var=$1
	echo $var

And the following calls with their respective output:

$ f1 "foo bar"
foo bar

$ f2 "foo bar"

Is this different behavior expected?  I've seen this happens with both /bin/sh
and /bin/ksh, though there is no mention to this in manpages, afaict.
Or should I be quoting assignments, like var="$1", to avoid problems?


Julio M. Merino Vidal <>
The NetBSD Project -