From 7ae7ef0afe0e067a1b96f69e508df52831a08b8b Mon Sep 17 00:00:00 2001 From: Joshua Rogers Date: Sat, 6 Jan 2024 01:49:55 +0700 Subject: [PATCH] Fix Snake.nocomments.sh producing an invalid script during remove_functions(). Snake.nocomments.sh incorrectly removed all leading spaces from the script, which resulted in remove_function() thinking that an awk function's } character was the final character of a bash function. Fixes #1. --- Snake.nocomments.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Snake.nocomments.sh b/Snake.nocomments.sh index 7b220f3..e61b73c 100755 --- a/Snake.nocomments.sh +++ b/Snake.nocomments.sh @@ -138,22 +138,22 @@ function is_func_line() { for (i in funcs) { if ($0 ~ "^" funcs[i] "\\(\\)") { return 1 -} -} + } + } return 0 -} + } function is_func_call() { for (i in funcs) { if ($0 ~ "^[[:space:]]*" funcs[i]) { return 1 -} -} + } + } return 0 -} + } BEGIN { split(fnames, funcs, " "); in_func = 0 -} + } is_func_line() { in_func = 1; next } /^\}/ { if (in_func) { in_func = 0; next } } is_func_call() { next } @@ -169,9 +169,9 @@ user = $1 for (i = 2; i <= NF; i++) { if ($i != "" && user != "") { print "\\x22" user "@" $i "\\x22" -} -} -}' + } + } + }' done for ssh_dest in "${!root_ssh_hosts_dests[@]}"; do printf "\\\x22%s\\\x22\n" "$ssh_dest"