Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

windows/shell: Invoke a System Command, using a Shell

shellR Documentation

Invoke a System Command, using a Shell

Description

shell runs the command specified bycmd, usually undera shell, because that is what the POSIX standards require.

Usage

shell(cmd, shell, flag = "/c", intern = FALSE, wait = TRUE,      translate = FALSE, mustWork = FALSE, ...)

Arguments

cmd

the system command to be invoked, as a string.

shell

a string giving the name of the shell to be used, orNULL (no shell). If missing, a suitable shell is chosen:see ‘Details’.

flag

the switch to run a command under the shell. If the shellisbash ortcsh orsh the default is changed to"-c".

intern

a logical, indicates whether to make the output of thecommand anR object.

wait

should theR interpreter wait for the command to finish?The default is to wait, and the interpreter will always wait ifintern = TRUE.

translate

IfTRUE,"/" incmd istranslated to"\".

mustWork

a logical; ifTRUE failure to run the commandwill give anR error, ifFALSE a warning and ifNA,noR message.

...

additional arguments tosystem.

Details

If noshell is specified, the environment variablesR_SHELL andCOMSPEC are tried in turn:COMSPECshould always succeed. Usingshell = NULL invokes the commandcmd directly, in which case an extension of ‘.exe’ isassumed. It is possible to use batch files directly if theirextension is given: Windows (rather thanR) then chooses a shell.

Seesystem for fuller details:shell is a moreuser-friendly wrapper forsystem. To make use of Windowsfile associations, useshell.exec.

Value

Ifintern = TRUE, a character vector giving the output of thecommand, one line per character string, or an error message if thecommand could not be run.

Ifintern = FALSE, the return value is an error code, given theinvisible attribute (so needs to be printed explicitly). If thecommand could not be run for any reason, the value is-1 andanR warning is generated. Otherwise ifwait = FALSE the valueis the error code returned by the command, and ifwait = TRUEit is the zero (the conventional success value),

Ifintern = FALSE andwait = TRUE (the defaults) the textoutput from a command that is a console application will appear intheR console (Rgui) or the window runningR (Rterm).

Note

This function exists only on Windows: on all other platformsystem uses a shell.

See Also

system,shell.exec


What can we improve?

R Package Documentation

Browse R Packages

We want your feedback!

Note that we can't provide technical support on individual packages. You should contact the package authors for that.

 
Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, readEmbedding Snippets.

Close

[8]ページ先頭

©2009-2026 Movatter.jp