# select a new default soundcard using dialog #removes old /tmp/ files this script created earlier first rm /tmp/newdefault.card; rm /tmp/newmod.tmp; rm /tmp/reload.sh; rm /tmp/card.dialog; rm /tmp/info.tmp rm /tmp/cards.tmp; rm /tmp/modules.tmp; rm /tmp/reload; rm /tmp/reload.tmp; rm /tmp/mods.tmp #creates a /tmp/crds file with your alsa soundcard info crds=$(cat /proc/asound/cards |sed 's/^.*\]: /\"/;/^$/!s/$/\"/' |sed -n '/ at /!p'); echo "$crds" >> /tmp/cards.tmp #creates a /tmp/modules.tmp file with info about your loaded sound modules mod=$(cat /proc/asound/modules |awk '{print $2}'); echo "$mod" >> /tmp/modules.tmp echo 'dialog --radiolist " This Script ONLY prints commands to use so its safe\n \' > /tmp/card.dialog echo 'Choose New Default Sound Card with up/down arrows\n \' >> /tmp/card.dialog echo 'Press spacebar to Select New Default Card\n \' >> /tmp/card.dialog echo 'Then Select \"OK\" button with left/right arrows\n And then Press Enter" 30 60 4 \' >> /tmp/card.dialog #pastes the /tmp/modules.tmp and /tmp/cards.tmp files into a new file /tmp/card.dialog paste /tmp/modules.tmp /tmp/cards.tmp >> /tmp/card.dialog #formats /tmp/card.dialog to dialog standards sed -i 's/"$/\" off \\/' /tmp/card.dialog #echos your choice of the new default soundcard to /tmp/newdefault.card echo "2>/tmp/newdefault.card" >> /tmp/card.dialog #runs /tmp/card.dialog and creates and runs /tmp/reload.sh #which only prints the commands to run and does NOT actually run the commands bash /tmp/card.dialog