From 40bd26f9ced3f97f58e261b2a213d35f2679a93f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 7 Jul 2025 02:31:01 +0200 Subject: [PATCH] awk/variables --- sh/code.awk | 4 ++++ sh/main.sh | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sh/code.awk b/sh/code.awk index 76c7641..65cccd6 100644 --- a/sh/code.awk +++ b/sh/code.awk @@ -58,6 +58,10 @@ BEGIN { if (match($0, RE_FUNCTION, m)) { print m[1] } + } else if (action == "variables") { + if (match($0, RE_CONSTANT, m)) { + print m[1] + } } else if (action == "aliases functions") { if (match($0, RE_ALIAS, m)) { append(m[1]) diff --git a/sh/main.sh b/sh/main.sh index 7c5b831..51799ce 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -246,8 +246,10 @@ rwx_parse_functions() { "${_rwx_code_awk}" } rwx_parse_variables() { - printf "%s" "${_rwx_code}" | - sed --silent "s|${RWX_REGEX_TARGET_VARIABLE}|\\1|p" + rwx_code | + awk \ + --assign action="variables" \ + "${_rwx_code_awk}" } # ╭──────┬─────╮