system

system([env,] command... [,options]) â true, false or nil
Instance Public methods

Executes command⦠in a subshell. command⦠is one of following forms.

commandline                 : command line string which is passed to the standard shell
cmdname, arg1, ...          : command name and one or more arguments (no shell)
[cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)

system returns true if the command gives zero exit status, false for non zero exit status. Returns nil if command execution fails. An error status is available in $?. The arguments are processed in the same way as for Kernel.spawn.

The hash arguments, env and options, are same as exec and spawn. See Kernel.spawn for details.

system("echo *")
system("echo", "*")

produces:

config.h main.rb
*

See Kernel.exec for the standard shell.

doc_ruby_on_rails
2015-04-17 12:31:19
Comments
Leave a Comment

Please login to continue.