From: Paul Hänsch Date: Mon, 9 Oct 2023 13:17:59 +0000 (+0200) Subject: workaround for hosters without /bin/awk X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=38e8338380e35f9c3c55c6232121cb7575d5cbfb;p=shellwiki workaround for hosters without /bin/awk --- diff --git a/parsers/60_macros.awk b/macros.awk 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 index 0000000..60ac8f3 --- /dev/null +++ b/parsers/60_macros.sh @@ -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