sysExecute

Category: System

Syntax:

sysExecute:Int(command:String)


Parameters

Returns

Int



Summary

Runs a command through the system shell and waits for it to finish.

Takes command (the command line to run). On Linux this is passed to /bin/sh, so shell syntax such as pipes, redirection and quoting works.

Returns -1 if the command string is empty. Otherwise it returns the raw status from the underlying system() call.

Note - the return value is a wait status, not the exit code. The exit code is in the high byte, so a program exiting with 1 gives 256, with 3 gives 768, and a command that could not be run at all gives 32512. Zero still means success, so testing = 0 is safe; to recover the exit code itself, divide by 256.

View detailed documentation online



Example
If sysExecute("ls -l > listing.txt") = 0 Then
	Print "Wrote listing.txt"
Else
	Print "Command failed"
EndIf

BambooBasic © 2026 Michael Denathorn