Skip to content

Instantly share code, notes, and snippets.

@KyMidd

KyMidd/asdf.sh Secret

Created July 7, 2024 19:22
Show Gist options
  • Save KyMidd/2f14598183c6d352c67ca3a193f35161 to your computer and use it in GitHub Desktop.
Save KyMidd/2f14598183c6d352c67ca3a193f35161 to your computer and use it in GitHub Desktop.
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