Skip to content

Instantly share code, notes, and snippets.

@kallmanation
Created August 23, 2019 12:31
Show Gist options
  • Save kallmanation/a93d85b14b49575c3f416c7dd3d7bd46 to your computer and use it in GitHub Desktop.
Save kallmanation/a93d85b14b49575c3f416c7dd3d7bd46 to your computer and use it in GitHub Desktop.
/bin/$ - copying commands from strangers on the internet with (slightly less) reckless abandon!
#!/bin/sh
# Copying dangerous commands from the internet and forgetting to trim the `$` off the start?
# Getting all sorts of `# -bash: $: command not found` errors?
# This script is for you!
# `$ command` will now ask for confirmation before executing the gum you scraped off of stackoverflow!
echo "You are about to run the command:"
echo "$@"
read -n 1 -p "Do you want to continue? [yN]: " answer
echo ""
if [ "$answer" == "y" ]; then
echo "--- executing ---"
"$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment