There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

gnuhaut ,

Like this?


<span style="color:#323232;">#!/bin/sh
</span><span style="color:#323232;">set -eu
</span><span style="color:#323232;">
</span><span style="color:#323232;">name_from_desc() {
</span><span style="color:#323232;">    LANG=C pactl list sinks 
</span><span style="color:#323232;">        | awk 'BEGIN {FS=": "} /Name:/ {name=$2} /Description:/ {print name, ":", $2}' 
</span><span style="color:#323232;">        | while IFS=' : ' read name desc; do
</span><span style="color:#323232;">        if [ "$desc" = "$1" ]; then echo "$name"; fi
</span><span style="color:#323232;">    done
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">id_from_name() {
</span><span style="color:#323232;">    pw-cli i "$1" | awk '/id:/ {print $2}'
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">ret=$(LANG=C pactl list sinks | awk 'BEGIN {FS=": "} /Description:/ {print $2}' | tofi)
</span><span style="color:#323232;">
</span><span style="color:#323232;">wpctl set-default $(id_from_name $(name_from_desc "$ret"))
</span>

I don’t get how that case statement of yours is even supposed to work. I’m pretty sure that’s just a syntax error. I guess you want to map from description to name? But that’s not remotely what that does.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines