How to ask password in bash scripts

http://linux-news.org/index.php/2013/03/09/dont-script-your-password-add-simple-prompts-to-shell-scripts/

Example:

#!/bin/bash
USER=matt
read -s -p "Password for $USER: " PASS
my-login -u $USER -p $PASS
Advertisements

8 thoughts on “How to ask password in bash scripts

  1. Awesome blog! Do you have any hints for aspiring writers?
    I’m hoping to start my own site soon but I’m a little lost on everything.

    Would you recommend starting with a free platform like WordPress or go for a paid option? There are so
    many choices out there that I’m totally overwhelmed
    .. Any tips? Cheers!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s