Skip to content

Instantly share code, notes, and snippets.

@Spitfire1900
Last active December 4, 2015 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Spitfire1900/3f9a504a44687d1a39ae to your computer and use it in GitHub Desktop.
Save Spitfire1900/3f9a504a44687d1a39ae to your computer and use it in GitHub Desktop.
Securely provide password for a bash one-liner.
#! /bin/bash
if [ -z $pass ]; then
read -s -p "Enter Password: " pass
printf "\n\r"
fi
@Spitfire1900
Copy link
Author

Usage example:
$ source passsec.sh; echo $pass => will prompt for password securely and then echo the password.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment