]> git.plutz.net Git - shellwiki/commitdiff
workaround for hosters without /bin/awk
authorPaul Hänsch <paul@plutz.net>
Mon, 9 Oct 2023 13:17:59 +0000 (15:17 +0200)
committerPaul Hänsch <paul@plutz.net>
Mon, 9 Oct 2023 13:17:59 +0000 (15:17 +0200)
macros.awk [moved from parsers/60_macros.awk with 100% similarity]
parsers/60_macros.sh [new file with mode: 0755]

similarity index 100%
rename from parsers/60_macros.awk
rename to macros.awk
diff --git a/parsers/60_macros.sh b/parsers/60_macros.sh
new file mode 100755 (executable)
index 0000000..60ac8f3
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# Copyright 2023 Paul Hänsch
+# 
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+# 
+# THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+if which awk >/dev/null; then
+  awk -f "$_EXEC/macros.awk"
+elif which busybox >/dev/null; then
+  busybox awk -f "$_EXEC/macros.awk"
+else
+  cat
+fi