Is there a way to hide the output of the aplay command when play a sound?
I tried this without success
$ aplay ~/.zsh/sounds/done.wav >> /dev/null
Playing WAVE '/home/oscar/.zsh/sounds/done.wav' : Unsigned 8 bit, Rate 11025 Hz, Mono
I'll appreciate your help.
Silencing Output To silence the output of a command, we redirect either stdout or stderr — or both — to /dev/null. To select which stream to redirect, we need to provide the FD number to the redirection operator.
If you are looking to suppress or hide all the output of a bash shell script from Linux command line as well as from the crontab then you can simply redirect all the output to a file known as /dev/null . This file is known as Black Hole which will engulf everything you give without complaining.
Use nohup if your background job takes a long time to finish or you just use SecureCRT or something like it login the server. Redirect the stdout and stderr to /dev/null to ignore the output. Just to add, sometimes there are arguments for the scripts then above command will return Ambiguous output redirect.
aplay is a command-line audio player for ALSA(Advanced Linux Sound Architecture) sound card drivers. It supports several file formats and multiple soundcards with multiple devices. It is basically used to play audio on command-line interface. aplay is much the same as arecord only it plays instead of recording.
Simply add the -q
option:
aplay -q ~/.zsh/sounds/done.wav
No need to redirect stdout to /dev/null there.
Another note: aplay
actuall sends messages to /dev/stderr (fd 2). You can also nullify the output by sending it to /dev/null:
aplay ~/.zsh/sounds/done.wav 2>/dev/null
You can see more options with aplay --help
. This line is about -q
:
-q, --quiet quiet mode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With