Back tick equivalent

If you’re interested in an actual interface to ps, see Sys-ProcTable,
available on the RAA.




On Tue, Sep 17, 2002 at 04:04:24AM +0900, CHENG, WEI CHI (LNG) wrote:

Just install ruby last Friday and tried to find the back
tick equivalent as
in shell script or perl to get the program output w/o
resort to some popen
trickery. Can not find it in the reference book or faq ?

e.g. what is the equivalent of below perl statement

@psout = `ps -elf | grep myusername`;

Backticks should work the same in ruby, if you want an array of lines,
you can do the following,

psout = ps -elf | grep myusername.split("\n")

without the .split("\n") you’d get one large string.

– alan