Skip to content

Instantly share code, notes, and snippets.

@sequielo
Created April 6, 2013 02:42
Show Gist options
  • Save sequielo/5324487 to your computer and use it in GitHub Desktop.
Save sequielo/5324487 to your computer and use it in GitHub Desktop.
Ask a password before launching a command
#!/bin/bash
hash=916f4c31aaa35d6b867dae9a7f54270d
while true
do
echo -ne "\n~~ Ingrese contraseña y presiona ENTER (nada para Salir): "
read -s pw
if [ -z $pw ]; then
echo
exit 1
fi
sum=$(echo $pw | md5sum | cut -d' ' -f1)
if [ $sum = $hash ];then
break
fi
done
echo
echo commando
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment