[PATCH] Remove double square bracket. [[ is a bash or ksh built-in, and cannot be used in a #!/bin/sh script.

Tim Niemeyer tim at tn-x.org
Mi Jul 25 23:07:49 CEST 2018


Hi

Ja, das stimmt.

Wir verwendet ash (busybox) und die kann mehr als die POSIX sh.
Insofern funktioniert das. Korrekterweise müsste man dann aber eine
andere Shell (ash) ansprechen und nicht die sh.

Reviewed-by: Tim Niemeyer <tim at tn-x.org>

Tim

PS: Da sind überall noch mehr solche Sachen, die man auch mit dem
shellchecker findet.


Am Mittwoch, den 25.07.2018, 16:45 +0200 schrieb Robert Langhammer:
> Signed-off-by: Robert Langhammer <rlanghammer at web.de>
> ---
>  src/packages/fff/fff-network/files/usr/sbin/configurenetwork | 10
> +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/packages/fff/fff-
> network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-
> network/files/usr/sbin/configurenetwork
> index 90024b3..0e038a4 100755
> --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> +++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> @@ -119,7 +119,7 @@ if ! uci -q get network.$SWITCHDEV > /dev/null ||
> [ "$FORCEPARSE" = '1' ] ; then
>      uci set network.${SWITCHDEV}_1.vlan=1
>      uci set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS"
>  
> -    if [[ "$WANDEV" = "$SWITCHDEV" ]] || ! [[ -z "$WAN_PORTS" ]];
> then
> +    if [ "$WANDEV" = "$SWITCHDEV" ] || ! [ -z "$WAN_PORTS" ]; then
>          uci set network.${SWITCHDEV}_2=switch_vlan
>          uci set network.${SWITCHDEV}_2.device=$SWITCHHW
>          uci set network.${SWITCHDEV}_2.vlan=2
> @@ -139,7 +139,7 @@ if ! uci -q get network.$SWITCHDEV > /dev/null ||
> [ "$FORCEPARSE" = '1' ] ; then
>  
>      uci set network.ethmesh.ifname="$SWITCHDEV.3"
>  
> -    if [[ "$WANDEV" = "$SWITCHDEV" ]]; then
> +    if [ "$WANDEV" = "$SWITCHDEV" ]; then
>          uci set network.wan.ifname=$WANDEV.2
>      else
>          uci set network.wan.ifname=$WANDEV
> @@ -175,7 +175,7 @@ fi
>  
>  /etc/init.d/network restart
>  
> -if [[ -n "$ETHMESHMAC" ]]; then
> +if [ -n "$ETHMESHMAC" ]; then
>      if uci get network.ethmesh.macaddr
>      then
>          echo "MAC for ethmesh is set already"
> @@ -193,7 +193,7 @@ if [[ -n "$ETHMESHMAC" ]]; then
>      fi
>  fi
>  
> -if [[ -n "$ROUTERMAC" ]]; then
> +if [ -n "$ROUTERMAC" ]; then
>      if uci get network.mesh.macaddr
>      then
>          echo "MAC for mesh is set already"
> @@ -211,7 +211,7 @@ if [[ -n "$ROUTERMAC" ]]; then
>      fi
>  fi
>  
> -if [[ -n "$ETH0MAC" ]]; then
> +if [ -n "$ETH0MAC" ]; then
>          echo "Fixing MAC on eth0"
>          sleep 10
>          NEW_MACADDR=$(cat "/sys/class/net/${ETH0MAC}/address")
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 488 bytes
Beschreibung: This is a digitally signed message part
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20180725/37843e1c/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev