-
-
Save KyMidd/2f14598183c6d352c67ca3a193f35161 to your computer and use it in GitHub Desktop.
This file contains 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
exit_if_not_local() { | |
# If not running locally, exit | |
if [[ $local_testing != true ]]; then | |
print_break | |
exit $1 | |
else | |
echo "🔴 Running locally, not exiting with code $1, press any key to continue" | |
# Wait for keypress to continue | |
while true; do | |
read -rsn1 key # Read a single character silently | |
if [ $? = 0 ]; then | |
echo -e "\n$key is pressed, continuing" | |
break # Exit the loop | |
else | |
echo "Waiting for a keypress" | |
fi | |
done | |
print_break | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment