From: Unix4Linux Unix4Linux Date: 2009-11-20T21:42:30+09:00 Subject: Re: For Loop Robert Klemme wrote: > On 19.11.2009 22:41, Unix4Linux Unix4Linux wrote: >> I also forgot to ask, in SHELL, when I run shell scripts, I can see what >> the script is doing. I am not referring to debug mode but more the >> output of each command being executed. >> >> Is this possible with Ruby? >> >> For example, in shell, if I had a command `yum -y install package_name`, >> I am able to see all of the required packages being installed...pretty >> much, I can see the process of it all. > > ["Account File", "Bank File", "Study Case", "Overall Status"].each > |group| > system "scp", group, 'user@server1:/tmp' > end > > Assuming all these "groups" are in a single directory you can also do > > Dir["#{dir}/*"].each |group| > system "scp", group, 'user@server1:/tmp' > end > > Then, if you want to process the output of the command you should look > into IO.popen. > > Kind regards > > robert Robert, Thanks for the input and also in pointing me to IO.popen. I appreciate the great help from you guys -- Posted via http://www.ruby-forum.com/.