Re: Running consecutive DOS commands in Ruby

3 views
Skip to first unread message

Srinidhi

unread,
Sep 2, 2010, 7:28:47 AM9/2/10
to Ruby on Rails: Talk
Hello Everyone,

I have a situation where i have to invoke command line tools like
putty_sftp and OpenSSH from ruby script for automation, as out
application handles sftp uploads through these tools.
So the problem is i can single DOS command in ruby and store the
output(using system( ),exec( )), but here were are talking abt
multiple DOS commands to achieve the goal.
Also i have to pick up values like user id and password from excel
file(which i am doing using ruby).I have to know how to pass these
value to DOS batch file from ruby.

It would be a boon if i can all the DOS commands in my ruby program
one by one, so it's easy to parametrize variables without much.
Please help me in this regard.................Thanks

Colin Law

unread,
Sep 2, 2010, 8:31:41 AM9/2/10
to rubyonra...@googlegroups.com
On 2 September 2010 12:28, Srinidhi <srini...@gmail.com> wrote:
> Hello Everyone,
>
> I have a situation where  i have to invoke command line tools like
> putty_sftp and OpenSSH from ruby script for automation, as out
> application handles sftp uploads through these tools.
> So the problem is i can single DOS command in ruby and store the
> output(using system( ),exec( )), but here were are talking abt
> multiple DOS commands to achieve the goal.

Put the commands in a batch file if you do not want to call them one by one.

> Also i have to pick up values like user id and password from excel
> file(which i am doing using ruby).I have to know how to pass these
> value to DOS batch file from ruby.

If the question is how to get them out of excel file I cannot help,
but to put them in the command just put them in the string you are
passing to system.

>
> It would be a boon if i can all the DOS commands in my ruby program
> one by one, so it's easy to parametrize variables without much.

I am confused, first you say you know how to run them one by one and
want to do them several at one go, then you ask how to pass params to
a batch file, then you say you want to run them one by one again.
Obviously I am missing something.

Colin

Reply all
Reply to author
Forward
0 new messages