[openwrt/openwrt] base-files: ipcalc.sh: use shebang to invoke awk
LEDE Commits
lede-commits at lists.infradead.org
Tue Feb 7 12:09:36 PST 2023
ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/6ce9f42b9819b93717d7425ca4135afec6ea43af
commit 6ce9f42b9819b93717d7425ca4135afec6ea43af
Author: Leon M. George <leon at georgemail.eu>
AuthorDate: Fri May 6 00:03:54 2022 +0200
base-files: ipcalc.sh: use shebang to invoke awk
There's hardly an shell logic in ipcalc.sh and a $* that would garble
parameter positions.
Move the awk invokation to the shebang.
A rename from "ipcalc.sh" to "ipcalc" is desirable but could prove tricky
with packages in other repositories depending on the filename.
Signed-off-by: Leon M. George <leon at georgemail.eu>
---
package/base-files/files/bin/ipcalc.sh | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/package/base-files/files/bin/ipcalc.sh b/package/base-files/files/bin/ipcalc.sh
index b21b6e28dc..e818e67803 100755
--- a/package/base-files/files/bin/ipcalc.sh
+++ b/package/base-files/files/bin/ipcalc.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#!/usr/bin/awk -f
-awk -f - $* <<EOF
function bitcount(c) {
c=and(rshift(c, 1),0x55555555)+and(c,0x55555555)
c=and(rshift(c, 2),0x33333333)+and(c,0x33333333)
@@ -82,4 +81,3 @@ BEGIN {
print "START="int2ip(start)
print "END="int2ip(end)
}
-EOF
More information about the lede-commits
mailing list