Sebastian Hungerecker
1/7/2009 4:24:00 PM
Gu stav wrote:
> For example, how would I perform the following sequence of commands in
> ruby:
>
> 1. cd /dir
> 2. ls
system "cd /dir; ls"
or:
Dir.chdir("/dir") do
system "ls"
end
or even better:
puts Dir["/dir/*"]
Generally there's no way to have the state from one system command affect
another, but you can change the pwd with Dir.chdir and you can change
environment variables using ENV.
HTH,
Sebastian
--
Jabber: sepp2k@jabber.org
ICQ: 205544826