I've set my output device to a connected speaker through "System Preferences..." -> "Sound" -> "Output" tab. When I open the terminal and type
echo -e "\a"; to create an alert/bell sound though, the audio comes through my built-in Macbook speakers (regardless of which other device is selected in my Sound Preferences).
Is there a way to change the output device for these alerts/bells from the Terminal?
I looked in the Preferences menu for the Terminal application but the closest thing I could find was the ability to enable/disable the Audible bell under the Profiles -> Advanced tab. There didn't seem to be a way to overwrite the system default audio device.
I'm not sure if this is relevant, but I'm on macOS Big Sur 11.6 on a 2017 MacBook Pro 15-inch. My Terminal is version 2.11 (440). I've also confirmed that sounds from other programs are using the selected default output device from my Sound Preferences.