sh ++/-- operators

Dan Nelson dnelson at allantgroup.com
Thu Jun 10 17:15:25 UTC 2010


In the last episode (Jun 10), RW said:
> FreeBSD's sh (in 8.0) doesn't seem to support the ++ or -- arithmetic
> operators
> 
>   $ echo "$((n++))"
>   arithmetic expression: syntax error: "n++"
> 
> Am I wrong in thinking these are POSIX operators? It seems odd if they
> were simply left-out..

Easy enough to check:

http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_04

 * The sizeof() operator and the prefix and postfix "++" and "--" operators
   are not required.

Patches welcome to implement them if you want them :)

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list