U:RDoc::NormalClass[iI" Shell:ET@I" Object;To:RDoc::Markup::Document: @parts[ o;;[o:RDoc::Markup::Paragraph;[I"QShell implements an idiomatic Ruby interface for common UNIX shell commands.;To:RDoc::Markup::BlankLineo; ;[I"OIt provides users the ability to execute commands with filters and pipes, ;TI"8like +sh+/+csh+ by using native facilities of Ruby.;T@S:RDoc::Markup::Heading: leveli: textI" Examples;T@S; ; i; I"Temp file creation;T@o; ;[I"QIn this example we will create three +tmpFile+'s in three different folders ;TI" under the +/tmp+ directory.;T@o:RDoc::Markup::Verbatim;[I":sh = Shell.cd("/tmp") # Change to the /tmp directory ;TI"?sh.mkdir "shell-test-1" unless sh.exists?("shell-test-1") ;TI"E# make the 'shell-test-1' directory if it doesn't already exist ;TI"Gsh.cd("shell-test-1") # Change to the /tmp/shell-test-1 directory ;TI")for dir in ["dir1", "dir3", "dir5"] ;TI" if !sh.exists?(dir) ;TI"= sh.mkdir dir # make dir if it doesn't already exist ;TI" sh.cd(dir) do ;TI"+ # change to the `dir` directory ;TI"G f = sh.open("tmpFile", "w") # open a new file in write mode ;TI"; f.print "TEST\n" # write to the file ;TI"@ f.close # close the file handler ;TI" end ;TI"N print sh.pwd # output the process working directory ;TI" end ;TI" end ;T: @format0S; ; i; I"!Temp file creation with self;T@o; ;[I"@This example is identical to the first, except we're using ;TI"CommandProcessor#transact.;T@o; ;[I"SCommandProcessor#transact executes the given block against self, in this case ;TI"Q+sh+; our Shell object. Within the block we can substitute +sh.cd+ to +cd+, ;TI":because the scope within the block uses +sh+ already.;T@o;;[I"sh = Shell.cd("/tmp") ;TI"sh.transact do ;TI"; mkdir "shell-test-1" unless exists?("shell-test-1") ;TI" cd("shell-test-1") ;TI"+ for dir in ["dir1", "dir3", "dir5"] ;TI" if !exists?(dir) ;TI" mkdir dir ;TI" cd(dir) do ;TI"& f = open("tmpFile", "w") ;TI" f.print "TEST\n" ;TI" f.close ;TI" end ;TI" print pwd ;TI" end ;TI" end ;TI" end ;T;0S; ; i; I"#Pipe /etc/printcap into a file;T@o; ;[I"MIn this example we will read the operating system file +/etc/printcap+, ;TI"Rgenerated by +cupsd+, and then output it to a new file relative to the +pwd+ ;TI" of +sh+.;T@o;;[ I"sh = Shell.new ;TI"7sh.cat("/etc/printcap") | sh.tee("tee1") > "tee2" ;TI"<(sh.cat < "/etc/printcap") | sh.tee("tee11") > "tee12" ;TI"8sh.cat("/etc/printcap") | sh.tee("tee1") >> "tee2" ;TI"<(sh.cat < "/etc/printcap") | sh.tee("tee11") >> "tee12";T;0: @fileI"lib/shell.rb;T:0@omit_headings_from_table_of_contents_below0o;;[;I"!lib/shell/builtin-command.rb;T;0o;;[;I"#lib/shell/command-processor.rb;T;0o;;[;I"lib/shell/error.rb;T;0o;;[;I"$lib/shell/process-controller.rb;T;0o;;[;I" lib/shell/system-command.rb;T;0;0;0[[ I" cascade;TI"RW;T: publicTI"lib/shell.rb;T[ I" debug;TI"R;T;T@n[ I" debug?;F@q;T@n[ I" verbose;TI"RW;T;T@n[ I" verbose?;FI"RW;T;T@n[ I"command_processor;TI"R;T;F@n[ I"cwd;TI"R;T;F@n[ I" debug;TI"R;T;F@n[ I" debug?;F@};F@n[ I"dir;F@;F@n[ I"dir_stack;TI"R;T;F@n[ I" dirs;F@„;F@n[ I" getwd;F@;F@n[ I"process_controller;TI"R;T;F@n[ I"pwd;F@;F@n[ I"record_separator;TI"RW;T;F@n[ I"system_path;TI"R;T;F@n[ I" umask;TI"RW;T;F@n[ I" verbose;TI"RW;T;F@n[ I" verbose?;FI"RW;T;F@n[[[I" Error;To;;[;@Z;0@n[[I" class;T[[;[[I"alias_command;F@n[I"cd;F@n[I" debug=;F@n[I"def_system_command;F@n[I"default_record_separator;F@n[I"default_record_separator=;F@n[I"default_system_path;F@n[I"default_system_path=;F@n[I"install_system_commands;F@n[I"new;T@n[I" notify;F@n[I"unalias_command;F@n[I"undef_system_command;F@n[:protected[[: private[[I" instance;T[[;[[I"cd;F@n[I" chdir;F@n[I" debug=;F@n[I"expand_path;F@n[I" inspect;F@n[I" jobs;F@n[I" kill;F@n[I" popd;F@n[I" popdir;F@n[I" pushd;F@n[I" pushdir;F@n[I"system_path=;F@n[;[[;[[[I"Exception2MessageMapper;To;;[;@Z;0@n[I"Forwardable;To;;[;@Z;0@n[U:RDoc::Context::Section[i0o;;[;0;0[ @Z@]@`@cI"lib/shell/filter.rb;T@f@iI"lib/shell/version.rb;T@øcRDoc::TopLevel