Rooot.net

  • Increase font size
  • Default font size
  • Decrease font size
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Home Geek stuff Linux Input a password in a bash script

Input a password in a bash script

Here is a very simple code snippet to ask for an input without showing it on display. Great for all password inputs.

#!/bin/sh
read -p "Username: " uname
stty -echo
read -p "Password: " passw; echo
stty echo

Comments
Add New Search
Anonymous   |193.50.79.xxx |2014-04-09 00:58:29
merci
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."