From: "Brian Schröder" Date: 2005-08-15T23:18:18+09:00 Subject: Re: Another Newbie question On 15/08/05, LenS wrote: > I am running Ruby 1.8.2 on a XP machine. I have several programs > (executables) which convert text files to a special file format. I > would like to have these programs run from within a ruby script and > check the return code. > > In general how would you call the foo.exe program in ruby and check > return code. > > Thanks > Len Sumnler > > def execute(*args) system(*args) $? end execute("echo 'test' | grep -q test") # => # execute("echo 'nothing' | grep -q test") # => # Read ri Process::Status for more information on the Process::Status Class. regards, Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/