Pregunta

I'm trying to change the volume of two simple mixer controls via amixer in a bash shell.

Here's the version of ALSA I'm running:

$ cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version k3.8.13-gentoo.

I have two simple mixer controls ('DAC',0 and 'DAC',1) which I'm interested in controlling:

$ amixer scontrols
...
Simple mixer control 'DAC',0
Simple mixer control 'DAC',1
...

I can easily set the volume of each control individually by using the amixer set command:

$ amixer set -c0 DAC,0 10%- && amixer set -c0 DAC,1 10%-

Although it works, executing amixer twice doesn't seem very eloquent to me. Is there a way to change the volume of multiple simple mixer controls using a single amixer execution?

¿Fue útil?

Solución

You can pass multiple commands through stdin:

amixer -c0 -sq <<-EOF
    set DAC,0 10%-
    set DAC,1 10%-
EOF
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top