以下の内容はhttps://tbpgr.hatenablog.com/entry/20140123/1390484711より取得しました。


Ruby | 標準入力からパスワードをechoせずに入力する

概要

標準入力からパスワードをechoせずに入力する

詳細

標準入力からパスワードをechoせずに入力します。

サンプル

# encoding: utf-8
require 'io/console'
require 'tbpgr_utils'

print "Enter password: "
password = STDIN.noecho(&:gets).chop
puts
puts_eval "password", binding

__END__
下記はTbpgrUtils gemの機能

puts_eval

詳しくは下記参照
https://rubygems.org/gems/tbpgr_utils
https://github.com/tbpgr/tbpgr_utils

出力

※「Enter password: 」の部分は実際にはpasswordと入力しているが表示されていない

$ ruby password_stdin.rb
Enter password: 
password # => "password"



以上の内容はhttps://tbpgr.hatenablog.com/entry/20140123/1390484711より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14