On 1 Aug, 21:59, Kyle Schmitt <kyleaschm... / gmail.com> wrote: > On Fri, Aug 1, 2008 at 2:54 PM, StéÍe Z.H <szere... / gmail.com> wrote: > > Not quite sure if I understood you right, but you could probably do > > something like this: > > res = `command` note: ` not ' > > > This executes 'command' and stores the output in res. > > StéÍe, > The problem with that is that it doesn't indicate whetherhe > command succeeded or failed. > > y the way, %x{ls /tmp} is identical to `ls /tmp`, it's just > easier to read :) > > --Kyle The return value of the program is stored in $? as far as I can see. I tested it on my laptop, and $? was set to 0 when the command succeeded and 1 when it didn't. (Of course, the return value depends on the program, but non-zero is generally considered failure.)