Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby21
/
share
/
ri
/
2.1.0
/
system
/
Shellwords
/
//opt/alt/ruby21/share/ri/2.1.0/system/Shellwords/cdesc-Shellwords.ri
U:RDoc::NormalModule[iI"Shellwords:EF@0o:RDoc::Markup::Document:@parts[o;;['S:RDoc::Markup::Heading: leveli: textI"3Manipulates strings like the UNIX Bourne shell;To:RDoc::Markup::BlankLine o:RDoc::Markup::Paragraph;[I"IThis module manipulates strings according to the word parsing rules ;TI"of the UNIX Bourne shell.;T@o; ;[I"GThe shellwords() function was originally a port of shellwords.pl, ;TI"Ibut modified to conform to POSIX / SUSv3 (IEEE Std 1003.1-2001 [1]).;T@S; ; i;I" Usage;T@o; ;[I"QYou can use shellwords to parse a string into a Bourne shell friendly Array.;T@o:RDoc::Markup::Verbatim;[ I"require 'shellwords' ;TI" ;TI"3argv = Shellwords.split('three blind "mice"') ;TI")argv #=> ["three", "blind", "mice"] ;T:@format0o; ;[I"COnce you've required Shellwords, you can use the #split alias ;TI"String#shellsplit.;T@o;;[I"*argv = "see how they run".shellsplit ;TI",argv #=> ["see", "how", "they", "run"] ;T;0o; ;[I"2Be careful you don't leave a quote unmatched.;T@o;;[I">argv = "they all ran after the farmer's wife".shellsplit ;TI"9 #=> ArgumentError: Unmatched double quote: ... ;T;0o; ;[I"JIn this case, you might want to use Shellwords.escape, or it's alias ;TI"String#shellescape.;T@o; ;[I"RThis method will escape the String for you to safely use with a Bourne shell.;T@o;;[I"/argv = Shellwords.escape("special's.txt") ;TI" argv #=> "special\\'s.txt" ;TI"system("cat " + argv) ;T;0o; ;[I"LShellwords also comes with a core extension for Array, Array#shelljoin.;T@o;;[I"argv = %w{ls -lta lib} ;TI"system(argv.shelljoin) ;T;0o; ;[I"SYou can use this method to create an escaped string out of an array of tokens ;TI"Nseparated by a space. In this example we'll use the literal shortcut for ;TI"Array.new.;T@S; ; i;I"Authors;To:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"Wakou Aoyama;To;;0;[o; ;[I"%Akinori MUSHA <knu@iDaemons.org>;T@S; ; i;I"Contact;To;;;;[o;;0;[o; ;[I":Akinori MUSHA <knu@iDaemons.org> (current maintainer);T@S; ; i;I"Resources;T@o; ;[I"V1: {IEEE Std 1003.1-2004}[http://pubs.opengroup.org/onlinepubs/009695399/toc.htm];T: @fileI"lib/shellwords.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ [ [[I" class;T[[:public[[I"escape;FI"lib/shellwords.rb;T[I" join;F@q[I"shellescape;F@q[I"shelljoin;F@q[I"shellsplit;F@q[I"shellwords;F@q[I" split;F@q[:protected[ [:private[ [I" instance;T[[;[ [;[ [;[ [@u@q[@w@q[@y@q[@{@q[ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@e@ecRDoc::TopLevel