ash: braceless function definiton

Mikhail Gusarov dottedmag at dottedmag.net
Fri Sep 24 19:21:25 UTC 2010


The following script:

----------------------------------------
#!/bin/sh

foo()
exit 1
----------------------------------------

exits with code 0, as lines 3-4 define function foo, despite missing
braces around 'exit 1'. Is is proper behaviour? SUSv3 grammar requires
compound statement as a body of function.

For the record: zsh and dash behave as ash, bash gives syntax error.

-- 
  http://fossarchy.blogspot.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20100925/aa3f5df2/attachment.pgp>


More information about the busybox mailing list