Skip to main content
1 of 3
Hey
  • 691
  • 9
  • 20

Ask for a password in POSIX-compliant shell?

When I want to ask for a password in a bash script, I do that :

read -s

...but when I run bash in POSIX mode, with sh, the option don't exists :

$ read -s
sh: 1: read: Illegal option -s

How do I securely ask for an input with a POSIX-compliant command ?

Hey
  • 691
  • 9
  • 20