Search code examples
linuxbashshellzsh

hide output of aplay shell command


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.


Solution

  • 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