Forum: Ruby on Rails Re: Running consecutive DOS commands in Ruby

Posted by Srinidhi (Guest)
on 2010-09-02 13:30
(Received via mailing list)
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
Posted by Colin Law (Guest)
on 2010-09-02 14:39
(Received via mailing list)
On 2 September 2010 12:28, Srinidhi <srinidhi158@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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.