On Monday 07 February 2011 15:52, Sven-Göran Bergh wrote:
> > > A better decision would be to write your scrips in
>
> > > standard-compliant shell.
> >
> > OK, pardon my ignorance then.
> >
> > It seems to me that the syntax for functions in ash and bash is different
> > and incompatible.
> >
>
> Ash is certainly not bash and you should not expect every
> bash corner to be there. If you do you are in for some
> surprises. Just from top of my head there are at least
> these differences (probably a lot more):
> - functions, as you mention. However, you can make them like:
> test() {echo hello} # skip "function"
> - arrays, does not exists in ash
> - pushd & popd, not in ash
> - for (( expr1; expr2; expr3 ))..., not in ash
> - parameter expansion, some more in bash than in ash
All of these are not in
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
either.
> - scope of variables (this is a killer!) All variables are global in ash
> unless declared as local. This goes for functions, loops, etc.
They are global in bash too:
$ f() { z=1; }
$ echo $z
$ f
$ echo $z
1
This is how they are supposed to work. It's not a bug.
> These are no big obsticles. Once you know about them it is easy to use
> alternative solutions. What I miss most in ash is probably arrays.
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox