Audio change script
-
Hi again mates. Im making an script to add a new element to the RetroPie menu, so i can change audio output between HDMI and Jack without entering the dos type menus, only pushing the new option i added.
The code its the next, im having problems so i dont know where is the problem, any help? Thanks.
#!/usr/bin/env bash
AUDIO=0
if [[AUDIO=0]]; then
amixer cset numid=3 1
AUDIO=1
else [[AUDIO=1]]; then
amixer cset numid=3 2
AUDIO=0
fiexit
Any help?
-
Well, I'd suggest you take a primer in Bash scripting, because there's some basic blocks that you're missing. I suggest using the Bash scriptiung guide to get started.
- The variables are referenced with
$VARNAME
, if
testing expression needs space around the condition
3 . The condition should be==
,=
is an assignment operator.- There's no
then
afterelse
andelse
does not have a test expression as
What you want is probably similar to this
#!/usr/bin/env bash AUDIO=0 if [[ $AUDIO==0 ]]; then echo "Audio zero" AUDIO=1 else echo "Audio one" AUDIO=0 fi
- The variables are referenced with
-
Thanks a lot, i solved it!!!
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.