Created
February 9, 2018 16:30
-
-
Save drewchapin/1fa97c5963e5b66c8c2a9f48a1e55368 to your computer and use it in GitHub Desktop.
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
#!/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