From: James Edward Gray II Date: 2005-06-10T01:59:23+09:00 Subject: Re: How to take password from user On Jun 9, 2005, at 11:19 AM, sujeet kumar wrote: > Hi > I have to take some password from user in a Ruby Program. I want > that when he type password an echo character like * prints on screen > and the program gets the password as string. I am using Ruby function > "gets" to get password. I don't want password to be seen by others. > Suggest me some way. The HighLine library (http://highline.rubyforge.org/) on RubyForge makes this (and more) trivial. Here's an example using that library: #!/usr/local/bin/ruby -w require "rubygems" require "highline/import" pass = ask("Enter your password: ") { |q| q.echo = false } # or q.echo = "*" puts "Your password is #{pass}!" __END__ Hope that helps. James Edward Gray II