From dea3f289c276dbcacfcf3415370373ccaefef8d5 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Wed, 3 Sep 2025 14:52:33 -0700 Subject: [PATCH] Fix quoting issues in bin/ --- bin/google-chrome-noroot | 10 +++++++--- bin/nvidia_hold.sh | 2 +- bin/pactl_helper | 2 +- bin/qdisc_span.sh | 2 +- bin/switch_virt.sh | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bin/google-chrome-noroot b/bin/google-chrome-noroot index 77c29cc..1d98f13 100755 --- a/bin/google-chrome-noroot +++ b/bin/google-chrome-noroot @@ -3,8 +3,12 @@ CHROME=`which google-chrome` if [ `id -u` != "0" ] ; then - exec $CHROME "$@" + exec "$CHROME" "$@" fi -CMD="${CHROME} --user-data-dir=${HOME}/.chrome-data-dir \"$@\"" -su -c "${CMD}" chromeuser +args=() +for x in "$@"; do + args+=("$(printf %q "$x")") +done + +su -c "$CHROME --user-data-dir=${HOME}/.chrome-data-dir ${args[*]}" chromeuser diff --git a/bin/nvidia_hold.sh b/bin/nvidia_hold.sh index 6866dec..0f10f22 100755 --- a/bin/nvidia_hold.sh +++ b/bin/nvidia_hold.sh @@ -5,7 +5,7 @@ function list_nvidia_installed { } function hold_or_unhold { - apt-mark "${1:-hold}" $(list_nvidia_installed) + list_nvidia_installed | xargs apt-mark "${1:-hold}" } case "$1" in diff --git a/bin/pactl_helper b/bin/pactl_helper index 2aa3433..d8e6810 100755 --- a/bin/pactl_helper +++ b/bin/pactl_helper @@ -37,7 +37,7 @@ function volume { case "$1" in mute|micmute|volume) - $* + "$@" ;; *) echo "Unknown command!" diff --git a/bin/qdisc_span.sh b/bin/qdisc_span.sh index 8b29290..546e59d 100755 --- a/bin/qdisc_span.sh +++ b/bin/qdisc_span.sh @@ -43,6 +43,6 @@ function get_bridge_ifaces { bridge link | grep "master ${1}" | cut -d: -f2 | cut -d@ -f1 } -for iface in $(get_bridge_ifaces "${BRIDGE}") ; do +get_bridge_ifaces "${BRIDGE}" | while IFS= read -r iface ; do handle_iface "$iface" done diff --git a/bin/switch_virt.sh b/bin/switch_virt.sh index 6cb259c..40368f2 100755 --- a/bin/switch_virt.sh +++ b/bin/switch_virt.sh @@ -7,7 +7,7 @@ fi if [ `whoami` != "root" ] ; then if which sudo >/dev/null 2>&1 ; then - sudo $0 $* + sudo "$0" "$@" exit fi echo "Sorry, this requires root." >&2