るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.085秒)

別のキーワード

  1. shellwords shelljoin
  2. array shelljoin
  3. shelljoin shellwords
  4. shelljoin array

ライブラリ

モジュール

検索結果

Shellwords.#shelljoin(array) -> String (18108.0)

配列の各要素である文字列に対して、Bourne シェルのコマンドライン中で安全に 使えるためのエスケープを適用し、空白文字を介してそれらを連結したコマンド ライン文字列を生成します。

...る配列を指定します。
@return エスケープ結果を連結した文字列を返します。

例:
require 'shellwords'

pattern = 'Jan 15'
file = 'file name with spaces'
puts Shellwords.shelljoin(['grep', pattern, file])
# => grep Jan\ 15 file\ name\ with\ spaces...