#!/bin/bash # Check the current default output device default_device=$(switchaudio -c) # If the current default device is the built-in speakers, switch to the USB audio interface if [ "$default_device" == "Built-in Output" ]; then switchaudio -t output -s "USB Audio Device" echo "Switched to USB Audio Device" # If the current default device is the USB audio interface, switch back to the built-in speakers else switchaudio -t output -s "Built-in Output" echo "Switched to Built-in Output" fi