Created
August 12, 2025 20:28
-
-
Save xrstf/537a4e3f5ed31241f0755089201f768e to your computer and use it in GitHub Desktop.
play sounds depending on the exit code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set +o errexit | |
"${@}" | |
EXIT_CODE=${?} | |
set -o errexit | |
SOUNDS_DIR="$HOME/bin/sounds" | |
SUCCESS_SOUND="yay-6120.mp3" # https://pixabay.com/sound-effects/yay-6120/ | |
ERROR_SOUND="error-126627.mp3" # https://pixabay.com/sound-effects/error-126627/ | |
if [ "$EXIT_CODE" -ne 0 ]; then | |
pw-play "$SOUNDS_DIR/$ERROR_SOUND" & | |
else | |
pw-play "$SOUNDS_DIR/$SUCCESS_SOUND" & | |
fi | |
exit "$EXIT_CODE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment