Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Executing a command using Net::SSH::Perl

by sugarboy (Beadle)
on Sep 23, 2010 at 12:28 UTC ( #861522=perlquestion: print w/replies, xml ) Need Help??

sugarboy has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

Am trying to executed the below command
net use Y: /DELETE
As there are some open files in it it asks for confirmation which is as follows:
There are open files and/or incomplete directory searches pending on the connection to Y:.

Is it OK to continue disconnecting and force them closed? (Y/N) N:

I would like delete irrespective of open files existing in it
Is it possible to provide execute the command providing interactive input as Y using Net::SSH::Perl
Thanks,

Sagar
  • Comment on Executing a command using Net::SSH::Perl

Replies are listed 'Best First'.
Re: Executing a command using Net::SSH::Perl
by marto (Cardinal) on Sep 23, 2010 at 12:50 UTC

    Ssh? This is a windows command line utility, do you usually connect to a remote windows machine via ssh? If you read the documentation for net use you'll find the /y parameter is what you want.

Re: Executing a command using Net::SSH::Perl
by dorko (Prior) on Sep 23, 2010 at 14:30 UTC
    Hello,

    I would do what marto recommended.

    But the docs for Net::SSH::Perl say this should work:

    # Runs the command $cmd on the remote server and returns # the stdout, stderr, and exit status of that command. # If $stdin is provided, it's supplied to the remote # command $cmd on standard input. my ($out, $err, $exit) = $ssh->cmd($cmd, $stdin )

    Cheers,

    Brent

    -- Yeah, I'm a Delt.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://861522]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2020-12-01 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?