Shellwords.shellescape implementation for Ruby 1.8
I wound up going with the Escape gem, which has the additional feature of using quotes by default, and only backslash-escaping when necessary.
How to hide password input from terminal in ruby script
Best method from @eclectic923's answer:
require 'io/console'
password = STDIN.noecho(&:gets).chomp
For 1.9.3 (and above), this requires you adding require 'io/console'
to your code.Original Answer:
Ruby "Password" is another alternative.Related Topics
Good Forms Helpers for Sinatra
Camelcase Instead of Snake_Case in Rails Db
Inspect or Clean Up The Working Tree Error When Installing Ruby 2.1.3 on MAC Os X 10.9.5
How to Write (Large) Files with Ruby Eventmachine
Generate Models from Existing Tables Using Rails 3
Mongodb Server Doesn't Start at Gitlab Runner Using Gitlab-Ci
"Previous Post" and "Next Post" Link in Show View (Nested Resources)
How Does Ruby's Sort Method Work with The Combined Comparison (Spaceship) Operator
Why Is Split(' ') Trying to Be (Too) Smart
Setting Up Configuration Settings When Writing a Gem
How to Remove a Url's Trailing Slash in a Rails App? (In a Seo View)
Ruby: Converting a Nested Ruby Hash to an Un-Nested One