From 1be01adbcf358dba2b3068b0f993bac3f68b8da7 Mon Sep 17 00:00:00 2001 From: Fabian Thomas Date: Sun, 12 May 2024 15:24:06 +0200 Subject: [PATCH] fix port stripped on white space When the port is something like "[Out] Speaker" the previous awk call only extracted "[Out]". Co-authored-by: Nicolas Chachereau --- pulseaudio-control.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pulseaudio-control.bash b/pulseaudio-control.bash index 99c60ef..4d128f7 100755 --- a/pulseaudio-control.bash +++ b/pulseaudio-control.bash @@ -69,7 +69,7 @@ function getCurVol() { # `nodeName`. function getNodeName() { nodeName=$(pactl list "s${SINK_OR_SOURCE}s" short | awk -v sink="$1" "{ if (\$1 == sink) {print \$2} }") - portName=$(pactl list "s${SINK_OR_SOURCE}s" | grep -e "S${SINK_OR_SOURCE} #" -e 'Active Port: ' | sed -n "/^S${SINK_OR_SOURCE} #$1\$/,+1p" | awk '/Active Port: / {print $3}') + portName=$(pactl list "s${SINK_OR_SOURCE}s" | grep -e "S${SINK_OR_SOURCE} #" -e 'Active Port: ' | sed -n "/^S${SINK_OR_SOURCE} #$1\$/,+1p" | awk -F ": " '/Active Port: / {print $2}') }