Using SHELL to get a list of processes

François Chaplais francois.chaplais at mines-paristech.fr
Thu Feb 5 14:49:48 EST 2009


Le 5 févr. 09 à 19:55, Hugh Senior a écrit :

> 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?
>
> /H

have you tried

    get shell("ps -aA")
    answer it

(just read man ps on my mac's terminal)
should work on any *nix system; I guess

HTH

François



More information about the use-livecode mailing list