BASH   62

pavolume bash

Guest on 21st April 2022 01:32:48 AM

  1. #!/bin/bash
  2.  
  3. if [[ $# -lt 1 ]] ; then
  4.     printf "\nPulseAudio volume setter. Add desired volume in percents as first parameter of this script.\n\n"
  5. else
  6.     echo "Volume WAS:"
  7.     pacmd list sinks | grep -A 1 sink: | sed -e '1d'
  8.     pactl set-sink-volume `pacmd list sinks | grep sink: | grep -o ' [0-9]\{1,\} '` $(($1 * 65535 / 100))
  9. fi
  10.  
  11. echo "Volume NOW IS:"
  12. pacmd list sinks | grep -A 1 sink: | sed -e '1d'

Raw Paste


Login or Register to edit or fork this paste. It's free.