Robert Klemme
3/5/2007 1:51:00 PM
On 05.03.2007 14:15, Rebhan, Gilbert wrote:
> Hi,
>
> i have a script that uses a password as input.
>
> The password is provided via gets_chomp
> in the shell.
>
> Is there a way to mask the password with *
> or do i have to write a gui for that ?
Maybe you can do that via curses. Other than that, you could use "stty
-echo" before and "stty echo" after the password input:
14:50:07 [~]: ruby -e 'system("stty", "-echo")
> puts "enter!"
> pass=gets.chomp
> puts "You entered #{"*" * pass.size}"
> system("stty", "echo")'
enter!
You entered ******
14:50:56 [~]:
Kind regards
robert