[LEDE-DEV] [PATCH v3 04/13] scripts: $/${} is unnecessary on arithmetic variables

Bastian Bittorf bb at npl.de
Thu Oct 6 05:09:01 PDT 2016

* Sebastian Moeller <moeller0 at gmx.de> [06.10.2016 13:48]:
> It might be not be necessary, but does it hurt? Are you concerned that the current practice will hide variables changing their "type" from arithmetic and that removing the $ prefix will silence this instead of giving an error message? Or does this change improve run time of the scripts noticeable? I am just asking, as a non-experts in shell coding it seems less error prone to always use ${VARIABLE_NAME}...

e.g. this case:

SUM=$(( A + B ))		# correct

instead of SUM=$(( $A + $B ))	# old

it is not about hurting, it's about make the code checkable.
"every" parser will complain about this mistake, so satisfy them
and we safe a few bytes 8-)

bye, bastian

More information about the Lede-dev mailing list