From: I did not Date: 2004-10-28T23:09:03+09:00 Subject: Re: run linux commands as ruby scripts On Thu, 28 Oct 2004 21:55:47 +0900, nkb wrote: > Hi. > I've 2 commands to run on my Linux. > A "ls -l" command, followed by a tar command. I would like to have the > commands in separate lines. > > I tried this > > exec "ls -l" > exec "tar tvf myfilename" > > Only the "ls -l" is executed. I'm not sure what is happening. Is it > possible to execute a series of commands in Ruby? Thanks for any help. Use back quotes: a=`ls -l` b=`tar tvf yourfilename` `cmd` returns STDOUT from the cmd. `cmd 2>&1` is you want STDERR (mixed with STDOUT) Look into popen and popen3 if you need to interact with cmd Hth.