#!/bin/sh AWK=/usr/bin/awk AWKOPTS="" # If we have GNU awk, which can show its copyright (-C), use its # "compatibility mode" (-c); One True Awk does not recognize -C and # exits nonzero. We could just always use -c, but it would show some # errors every time when run with One True Awk. if $AWK -C >/dev/null 2>/dev/null; then AWKOPTS=" -c "; fi the_awk_code=$(mktemp -t polyshawk.XXXXXXXX) sed -n '/^# ---OTAWK CODE BELOW---/,$p' $0 > $the_awk_code $AWK $AWKOPTS -f $the_awk_code "${@}" exitcode=$? rm -f $the_awk_code return $? : <<'#---ENDOTAWKCODE---qLOCcmbFZJd83aPhXW7l8TG4ybyFchUPuWPAjnNQLMheDr9KbHw' # ---OTAWK CODE BELOW--- BEGIN { print "hi" } #---ENDOTAWKCODE---qLOCcmbFZJd83aPhXW7l8TG4ybyFchUPuWPAjnNQLMheDr9KbHw