From 6d5cbeb41623f32c8dce8e10e1c1539c88b8da89 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 2 Feb 2024 10:33:43 -0600 Subject: Slight tweak to remove spurious variable --- subtext.awk | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/subtext.awk b/subtext.awk index 2eedeeb..09ec882 100644 --- a/subtext.awk +++ b/subtext.awk @@ -11,13 +11,12 @@ BEGIN { dryrun = dryrun ? dryrun : 0 sopath = sopath ? sopath : ".:" ENVIRON["HOME"] "/.subtext" shxend = shxend ? shxend : "%%end" - ## Kernel + ## Shellfix: escape ` and $ in input # Ask sed to do these b/c awk has no capture groups ;_; shellfix = "sed -E" \ " -e 's/`/\\\\`/g'" \ " -e 's/(^|[^\\$])\\$([^\\$]|$)/\\1\\\\$\\2/g'" \ " -e 's/(^|[^\\$])\\$(\\$+)([^\\$]|$)/\\1\\2\\3/g'" - shxquote = " -e 's/^/:/'" } /\\$/ { # line continuation @@ -77,8 +76,8 @@ END { print "### body" print "body(){ unquote : << \\_ | shexpand" pushpar() - print body | (shellfix shxquote) - close(shellfix shxquote) + print body | (shellfix " -e 's/^/:/'") + close(shellfix " -e 's/^/:/'") print "_" print "}" if (!dryrun) print "body" -- cgit 1.4.1-21-gabe81