netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] ifcfg/rtpr: convert to POSIX shell
@ 2018-01-09 23:19 Mike Frysinger
  2018-01-10 16:28 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2018-01-09 23:19 UTC (permalink / raw)
  To: stephen.hemminger, netdev

From: Mike Frysinger <vapier@chromium.org>

These files are already mostly written in POSIX shell, so convert their
shebangs to /bin/sh and tweak the few bashisms in here.

URL: https://crbug.com/756559
Reported-by: Pat Erley <perley@chromium.org>
Signed-off-by: Mike Frysinger <vapier@chromium.org>
---
 ip/ifcfg | 12 ++++++------
 ip/rtpr  |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ip/ifcfg b/ip/ifcfg
index 851b9215ab63..5b34decd4480 100644
--- a/ip/ifcfg
+++ b/ip/ifcfg
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
 # SPDX-License-Identifier: GPL-2.0
 
 CheckForwarding () {
@@ -7,7 +7,7 @@ CheckForwarding () {
   fwd=0
   if [ -d $sbase ]; then
     for dir in $sbase/*/forwarding; do
-      fwd=$[$fwd + `cat $dir`]
+      fwd=$(( fwd + $(cat "$dir") ))
     done
   else
     fwd=2
@@ -128,12 +128,12 @@ fi
 arping -q -A -c 1 -I $dev $ipaddr
 noarp=$?
 ( sleep 2 ;
-  arping -q -U -c 1 -I $dev $ipaddr ) >& /dev/null </dev/null &
+  arping -q -U -c 1 -I $dev $ipaddr ) >/dev/null 2>&1 </dev/null &
 
-ip route add unreachable 224.0.0.0/24 >& /dev/null
-ip route add unreachable 255.255.255.255 >& /dev/null
+ip route add unreachable 224.0.0.0/24 >/dev/null 2>&1
+ip route add unreachable 255.255.255.255 >/dev/null 2>&1
 if [ "`ip link ls $dev | grep -c MULTICAST`" -ge 1 ]; then
-  ip route add 224.0.0.0/4 dev $dev scope global >& /dev/null
+  ip route add 224.0.0.0/4 dev $dev scope global >/dev/null 2>&1
 fi
 
 if [ $fwd -eq 0 ]; then
diff --git a/ip/rtpr b/ip/rtpr
index 192a476f817e..7e48674bcf53 100644
--- a/ip/rtpr
+++ b/ip/rtpr
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
 # SPDX-License-Identifier: GPL-2.0
 
 exec tr "[\\\\]" "[
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] ifcfg/rtpr: convert to POSIX shell
  2018-01-09 23:19 [PATCH iproute2] ifcfg/rtpr: convert to POSIX shell Mike Frysinger
@ 2018-01-10 16:28 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2018-01-10 16:28 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: stephen.hemminger, netdev

On Tue,  9 Jan 2018 18:19:59 -0500
Mike Frysinger <vapier@gentoo.org> wrote:

> From: Mike Frysinger <vapier@chromium.org>
> 
> These files are already mostly written in POSIX shell, so convert their
> shebangs to /bin/sh and tweak the few bashisms in here.
> 
> URL: https://crbug.com/756559
> Reported-by: Pat Erley <perley@chromium.org>
> Signed-off-by: Mike Frysinger <vapier@chromium.org>
> ---
>  ip/ifcfg | 12 ++++++------
>  ip/rtpr  |  2 +-
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 

Make sense applied. Thanks Mike

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-10 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-09 23:19 [PATCH iproute2] ifcfg/rtpr: convert to POSIX shell Mike Frysinger
2018-01-10 16:28 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).