Using SHELL to get a list of processes
Scott Rossi
scott at tactilemedia.com
Thu Feb 5 14:35:00 EST 2009
Recently, Hugh Senior wrote:
> Goal:
> Using shell()to determine if my Rev app is among the line of all running
> processes. If so, then user has started a second instance and I want to
> quit.
>
> Task 1: Get a list of all running processes and IDs.
> Task 2: Get the process name and ID of my Rev app.
>
> With me so far? Okay...
>
> I should be able to get a list of all running process using "ps -e"
> (according to http://www.ss64.com/bash/ps.html).
>
> So I try this in the message box, hoping to see some sort of a list:
>
> answer shell("ps -e")
>
> What I get instead is 'ps is not recognised as an internal or external
> command, operable program or batch file.'
>
> Same result using shell("top") and shell("list-processes").
>
> So what stupidity am I doing, please (apart from naively expecting the
> syntax to work)? And how do I get the process name & ID of the app?
This worked for me:
put "ps -A" into tCommand
answer shell(tCommand)
Revolution is in the result.
Regards,
Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
More information about the use-livecode
mailing list