Can I set up my own sub-environment?
Denys Vlasenko
vda.linux at googlemail.com
Tue Feb 8 20:23:54 UTC 2011
On Tuesday 08 February 2011 19:31, David Collier wrote:
> and ash has
>
> fred{}
>
> which means I was right originally - bash and ash scripts containing
> functions are syntactically incompatible.
No, fred{ ... } is not a correct syntax to define functions,
in any shell (I know of).
If it were, it would be a bug. { and } tokens in shell syntax are
special only as the first word in the command. In all other cases,
they are ordinary chars. Try these examples:
echo { Hi! }
{ echo }; }
{ echo Ho; {echo Hi; }
And finally, your example:
bash$ ash
$ fred{ cmd; cmd; }
ash: fred{: not found
ash: cmd: not found
$ fred { cmd; cmd; }
ash: fred: not found
ash: cmd: not found
It tried to execute pairs of commands:
"fred{" "cmd" ; "cmd"
and
"fred" "{" "cmd" ; "cmd"
(A small bug is visible here: ash doesn't complain about unpaired
closing '}' which is present in this example. bash and hush do. )
--
vda
More information about the busybox
mailing list