Error getting tags :
error 404Error getting tags :
error 404 shell | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
shell
Basics
Expander triangle
Type
Function
Syntax
the shell of commandLine shell(commandLine)
Introduced
1.0
Changed
2.0
Environment
Desktop, Web and Server
Platform Support
Mac OS X,Windows,Linux
Security
None required
Summary
Runs a shell command and returns its output.
Examples

shell("ls -l *.txt") -- returns a listing of the current dir on Unix
shell(field "Command")
shell("attrib main.rev +R")

Additional Comments
Expander triangle

Use the shell function to execute a command line.

Parameters:

The commandLine is a string or an expression that evaluates to a string.

Value:

The shell function returns a string.

Comments:

The commandLine must be a valid shell command on the current operating system. Use the shellCommand property to set the shell you want to use. The command is executed in the current defaultFolder.

Note: If you use a file path in the shell command on a Windows system, the file path must be in Windows form, not the Unix-style file paths that Revolution uses internally.

The value returned by the shell function is the result of the commandLine, including any error messages the commandLine generates. (On Unix systems, the stdout and stderr are combined to create the return value.) The current handler pauses until the shell returns its result. If the command was successful but did not return anything, the shell function returns empty.

The result is set to the shell command's exit code.

To prevent a console window from appearing when the shell command is executed, set the hideConsoleWindows property to true.

Tip: If you are having problems with the shellfunction, try executing the commandLine at your operating system's shell prompt. (For example, on an OS X system, try executing the commandLine in the Terminal window.) If a commandLine does not work at the shell prompt, it won't work with the shellfunction either, so trying this can be useful when debugging.

Changes to Revolution:

Support for using the shell command on OS X systems was added in version 2.0.

In version 2.0 and later, the shell function returns empty if a shell command (that does not normally return any data) was successful. In previous versions, the shell function returned zero in this case.

User Comments
Expander triangle
User thumbnail
Francois Chaplais
StarStarStarStarStar
Sep 1, 2009
Mac OS X note: the environment variables which are available in the shell function may not be the same as those available in the Terminal app. For instance, it may be necessary to update the $PATH variable to make some commands available to the shell function.