[Ruby] ruby でシェルコマンドを実行する
memo.
[markdown]
これを作るときに必要で調べたメモ。
> * [MacOSX – Alfred と brew cask が壊れた – Qiita](http://qiita.com/DriftwoodJP/items/4d4c7784513173a55ee2)
> * [brew-cask-reinstall.rb](https://gist.github.com/DriftwoodJP/3518cf3a032a4c5b6cc7)
## shell command
実行方法によって返値が違うので、目的に応じて使い分ける。
> * [Rubyで外部コマンドを実行して結果を受け取る方法あれこれ – Qiita](http://qiita.com/tyabe/items/56c9fa81ca89088c5627)
> * [Rubyでシェルコマンドを実行する方法 — ぺけみさお](http://www.xmisao.com/2014/03/01/how-to-execute-a-shell-script-in-ruby.html)
> * [Running command line commands within Ruby script – Stack Overflow](http://stackoverflow.com/questions/3159945/running-command-line-commands-within-ruby-script)
## readline
> * [module function Readline.#readline](http://docs.ruby-lang.org/ja/2.1.0/method/Readline/m/readline.html)
>
> prompt を出力し、ユーザからのキー入力を待ちます。 エンターキーの押下などでユーザが文字列を入力し終えると、 入力した文字列を返します。 このとき、add_hist が true であれば、入力した文字列を入力履歴に追加します。 何も入力していない状態で EOF(UNIX では ^D) を入力するなどで、 ユーザからの入力がない場合は nil を返します。
[/markdown]