djyoung4
August 1st, 2012, 08:31 AM
So I am working on a short if statement that switchs the sound between the speaker output and the hdmi output depending on where .asoundrc is. I want the script to move .asoundrc back and forth between two locations but I can only get it to do one or the other. I think somewhere in my syntax is wrong and I was hoping another set of eyes may be able to help. Any help is greatly appreciated
#!/bin/bash
#switches sound between hdmi and speakers
if [ -f `~/Documents/.asoundrc`]; then
mv ~/Documents/.asoundrc ~/.asoundrc
sudo rc.d force-restart alsa
notify-send hdmi sound
else
mv ~/.asoundrc ~/Documents/.asoundrc
sudo rc.d force-restart alsa
notify-send laptop sound
fi
#!/bin/bash
#switches sound between hdmi and speakers
if [ -f `~/Documents/.asoundrc`]; then
mv ~/Documents/.asoundrc ~/.asoundrc
sudo rc.d force-restart alsa
notify-send hdmi sound
else
mv ~/.asoundrc ~/Documents/.asoundrc
sudo rc.d force-restart alsa
notify-send laptop sound
fi