[OpenWrt-Devel] [PATCH] ubox: Run init script through shellcheck

Petr Štetiar ynezz at true.cz
Wed Jul 24 13:50:39 EDT 2019


Rosen Penev <rosenp at gmail.com> [2019-07-24 10:32:31]:

> SC2004: $/${} is unnecessary on arithmetic variables.
> SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.

Can you please provide some details, why should we care about this shellcheck
warnings ?

> -	PIDCOUNT="$(( ${PIDCOUNT} + 1))"
> +	PIDCOUNT="$(${PIDCOUNT} + 1)"

You maybe fixed warning, but introduced bug:

 $ PIDCOUNT=2 echo "$(${PIDCOUNT} + 1)"
 /bin/ash: 2: not found

So that shellcheck thingy probably wanted:

 PIDCOUNT="$((PIDCOUNT + 1))"

-- ynezz

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list