os.execute()

Type Function
Library os.*
Return value Number
Revision 2017.3060
Keywords os, execute, shell, commands
See also os.exit()

Overview

Passes a string to the operating system for execution and returns a system-dependent status code. This function is equivalent to the C function system().

This function returns a number representing the status code with the system-dependent results of the command.

Gotchas

This function does not work on devices.

Syntax

os.execute( cmd )
cmd (required)

String. String specifying a command to be executed by an operating system shell. The function of this command depends on what is allowed by the running OS. If cmd is not specified, the return value is non-zero if a shell is available, or zero otherwise.

Example

os.execute( "ls" )