[LTP] [PATCH 1/1] net/sctp: Fix parsing input variables in dash

Cyril Hrubis chrubis@suse.cz
Tue May 15 14:04:28 CEST 2018


Hi!
> Dash (and maybe some other posix shells) cannot handle unquoted $@.
> It needs to be quoted when calling otherwise leads to error:
> /opt/ltp/testcases/bin/sctp01.sh: 40: local: 65000: bad variable name

It looks like this patch is working around the real problem.

Looking into bash and dash manual pages the syntax for local builtin is
slightly differente between these two.

The dash contains:

local [variable | -] ...

While bash has:

local [option] [name[=value] ... | - ]


So it looks to me like the portable way how to declare local variables is:

function()
{
	local var_name

	var_name=$foo

	...
}


And it also seems to be mentioned in one of the dash porting guides:

http://mywiki.wooledge.org/Bashism

See the builtins paragraph there.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list