Skip to content
bergsma edited this page Sep 26, 2014 · 3 revisions

#exec

###Execute a exec shell command.

Syntax

status = exec command ;

Arguments

  1. str command

The command to execute.

Return Value

list status
  • $ACKNOWLEDGE : The command was executed.

The STATUS variable is set to $ACKNOWLEDGE

list status
  • $ACKNOWLEDGE : The command was executed.

The STATUS variable is set to $ACKNOWLEDGE

Exceptions

  • %ARGUMENT: Invalid arguments. Usage: status = exec command ;

  • %IO: Command string to long.

Description

In both UNIX and VMS systems, the system() function calls the system() 'C' run-time library function. Unless you require a result back from the command, it is preferable to use the system() function. The exec() command, on the other hand, is much more complex in the UNIX environment. In the VMS environment, system() and exec() and equivalent. In UNIX, the exec() command results in a fork'ed process with stdout redirected to with the resulting internal command:

execl ( "/bin/sh", "sh", "-c", command, (char *) 0 ) ;

Also, the exec() function in the UNIX environment returns the last line of stdout. If there is not output, the return value is 0.

Examples

puts "Create an example for the function 'exec'" ;

Related Links

None

Clone this wiki locally