Following the x character is a delimiter, which can be any character.If the delimiter is one of the characters (, [, {, or <,the literal consists of the characters up to the matching closing delimiter,taking account of nested delimiter pairs. For all other delimiters, theliteral comprises the characters up to the next occurrence of thedelimiter character. String interpolation #{ ... } is allowed.
Returns the result (i.e. standard output) of the shell command, just like the backticks.
exec( "echo 'hi'" )exec( cmd ) # Note: this will never be reached because of the line above
Here's some extra advice:$?, which is the same as $CHILD_STATUS, accesses the status of the last system executed command if you use the backticks, system() or %x{}.You can then access the exitstatus and pid properties:
env: hashname => val : set the environment variablename => nil : unset the environment variablecommand...:commandline : command line string which is passed to the standard shellcmdname, arg1, ... : command name and one or more arguments (no shell)[cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)options: hashclearing environment variables::unsetenv_others => true : clear environment variables except specified by env:unsetenv_others => false : dont clear (default)process group::pgroup => true or 0 : make a new process group:pgroup => pgid : join to specified process group:pgroup => nil : dont change the process group (default)create new process group: Windows only:new_pgroup => true : the new process is the root process of a new process group:new_pgroup => false : dont create a new process group (default)resource limit: resourcename is core, cpu, data, etc. See Process.setrlimit.:rlimit_resourcename => limit:rlimit_resourcename => [cur_limit, max_limit]current directory::chdir => strumask::umask => intredirection:key:FD : single file descriptor in child process[FD, FD, ...] : multiple file descriptor in child processvalue:FD : redirect to the file descriptor in parent processstring : redirect to file with open(string, "r" or "w")[string] : redirect to file with open(string, File::RDONLY)[string, open_mode] : redirect to file with open(string, open_mode, 0644)[string, open_mode, perm] : redirect to file with open(string, open_mode, perm)[:child, FD] : redirect to the redirected file descriptor:close : close the file descriptor in child processFD is one of follows:in : the file descriptor 0 which is the standard input:out : the file descriptor 1 which is the standard output:err : the file descriptor 2 which is the standard errorinteger : the file descriptor of specified the integerio : the file descriptor specified as io.filenofile descriptor inheritance: close non-redirected non-standard fds (3, 4, 5, ...) or not:close_others => false : inherit fds (default for system and exec):close_others => true : dont inherit (default for spawn and IO.popen)