Skip to content

Instantly share code, notes, and snippets.

@rockerBOO
Created November 27, 2022 20:48
Show Gist options
  • Save rockerBOO/f6d65437c236a16161ced85437c984d7 to your computer and use it in GitHub Desktop.
Save rockerBOO/f6d65437c236a16161ced85437c984d7 to your computer and use it in GitHub Desktop.
Example running sound effect based on the exit code of a command. Customize to taste.
#!/usr/bin/env bash
success_sound="$HOME/code/audio-player/creamy2.ogg"
failure_sound="$HOME/code/audio-player/output.ogg"
# https://github.com/rockerBOO/audio-player
player="$HOME/code/audio-player/target/release/audio-player"
cargo build "$@"
last_run=$?
if [ $last_run == 0 ]; then
$player --volume 0.2 "$success_sound" &
else
$player --volume 0.2 --speed 2 "$failure_sound" &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment