Murga-Projects Forums

Full Version: os.execute
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to run a system command and receive the standard output in a variable? os.execute returns only a status code.
Hey

Another quick response from an internet cafe as I don't get back for another week ...

Effectively that is what the test_pid example does although it is a little cryptic.

I'll post updated code on here soon as I get a chance.

Cheers
JohnM
There is also io.popen("my_command")

more specifically:

Code:
my_cmd=io.popen("my_command") -- runs command
my_result=my_cmd:read("*a") -- read output of command to a variable
print(my_result)
my_cmd:close()

Thanks mikshaw. That worked like a charm.
Reference URL's