Created
November 21, 2019 20:42
-
-
Save isaaclw/f4e04516425dfd1ef0e2573f0bec87d1 to your computer and use it in GitHub Desktop.
Confirm a command
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
#!/bin/bash | |
echo -n "Do you want to run '$*'? [N/y] " | |
read -N 1 REPLY | |
echo | |
if test "$REPLY" = "y" -o "$REPLY" = "Y"; then | |
"$@" | |
else | |
echo "Cancelled by user" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment