From: "Jan-Erik R." Date: 2009-01-08T01:28:52+09:00 Subject: Re: Multiple commands in shell Gu stav schrieb: > I'm trying to run multiple commands in the shell from ruby but I can't > seem to grasp how I keep the "state" from the previous shell command. > > For example, how would I perform the following sequence of commands in > ruby: > > 1. cd /dir > 2. ls > > Not counting "ls /dir" that is ;) > > I've tried using: > > system "cd /dir" > system "ls" > > ..but it doesn't work. > > Thanks! Ruby provides excellent classes for this called Dir and File (and maybe FileUtils) RDoc can be found at: http://www.ruby-doc.org/core/classes/File.html and http://www.ruby-doc.org/core/classes/Dir.html