Skip to content

Instantly share code, notes, and snippets.

@kallmanation
Created Aug 23, 2019
Embed
What would you like to do?
/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