diff options
author | Thomas Haller <thaller@redhat.com> | 2023-03-09 16:56:18 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-03-09 16:56:18 +0100 |
commit | 9bf193f1a8fb2dc53f1026a5d38fcfe575976fcb (patch) | |
tree | 135d8b2663fe675e2a3eccba23aed8f19d9e04e1 | |
parent | 3c548dd08150d5f3d2c23f5f9a6d0da429732f04 (diff) |
contrib: escape shell arguments in "nm-setup-git.sh" output
-rwxr-xr-x | contrib/scripts/nm-setup-git.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/contrib/scripts/nm-setup-git.sh b/contrib/scripts/nm-setup-git.sh index b735a9fa1c..0e3610c5af 100755 --- a/contrib/scripts/nm-setup-git.sh +++ b/contrib/scripts/nm-setup-git.sh @@ -34,16 +34,26 @@ die() { exit 1 } +_pprint() { + local a + local sp='' + + for a; do + printf "$sp%q" "$a" + sp=' ' + done +} + call() { local m="" [ "$SKIP" = 1 ] && m="SKIP: " if [ "$NO_TEST" != 1 ]; then - printf "WOULD: %s%s\n" "$m" "$*" + printf "WOULD: %s%s\n" "$m" "$(_pprint "$@")" return 0 fi - printf "CALL: %s%s\n" "$m" "$*" + printf "CALL: %s%s\n" "$m" "$(_pprint "$@")" [ "$SKIP" = 1 ] || "$@" } |