method
shelljoin
v2_4_6 -
Show latest stable
-
0 notes -
Class: Shellwords
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (38)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
shelljoin(array)
public
Builds a command line string from an argument list, array.
All elements are joined into a single string with fields separated by a space, where each element is escaped for the Bourne shell and stringified using to_s.
ary = ["There's", "a", "time", "and", "place", "for", "everything"] argv = Shellwords.join(ary) argv #=> "There\\'s a time and place for everything"
Array#shelljoin is a shortcut for this function.
ary = ["Don't", "rock", "the", "boat"] argv = ary.shelljoin argv #=> "Don\\'t rock the boat"
You can also mix non-string objects in the elements as allowed in Array#join.
output = `#{['ps', '-p', $$].shelljoin}`