Skip to content

Instantly share code, notes, and snippets.

@drewchapin
Created February 9, 2018 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewchapin/1fa97c5963e5b66c8c2a9f48a1e55368 to your computer and use it in GitHub Desktop.
Save drewchapin/1fa97c5963e5b66c8c2a9f48a1e55368 to your computer and use it in GitHub Desktop.
#!/bin/bash
on_exit() {
echo "#Exited unexpectidly"
zenity --display=:0 --error --text="Program has exited unexpectidly!"
}
exec &> >(zenity --display=:0 --progress --title 'Redirection example' --text 'Running...' --auto-close)
trap "on_exit" EXIT
for i in $(seq 1 100); do
echo $i
echo "#Running... $i%"
sleep 0.1
if [ $i == 50 ]; then
exit 42
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment