Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Query on Running perl Script in linux

by dbuckhal (Chaplain)
on Feb 25, 2014 at 04:45 UTC ( [id://1076085]=note: print w/replies, xml ) Need Help??


in reply to Query on Running perl Script in linux

If that is your exact code you are trying to use, then it is missing the "shebang!" line. In Windows, you probably have file association doing the work for you in relating your Perl script to whatever Perl you have installed (Strawberry, Activestate,etc...).

But, on the Unix/Linux platform, you can add the program to execute your script on the first line:

#!/usr/bin/perl

Otherwise, you can also run your script by calling "perl", followed by your script name as the argument:

$ perl my_script.pl

On Unix/Linux, just type "which perl" at the prompt and that will tell you the path to use when you add the "shebang!" line at the top of your code

So, your first few lines of you code would look like this:

#!/usr/bin/perl use Net::SSH::Any; use Config::IniFiles; # Check for valid number of arguments if (!defined $ARGV[0] && !defined $ARGV[1]) { die("Usage: export_ddts.pl projectname tmpl_path \n"); }; . . .

The only thing left would to just make it executable:

chmod +x myScript.pl

...and you will be able to run it by just typing its name at the prompt.

$ ./myScript

NOTE: this just assumes that your posted code is exactly what you are trying to execute and I just noticed the "shebang!" missing. If I'm way off target, my bad. :)

Replies are listed 'Best First'.
Re^2: Query on Running perl Script in linux
by naghaveer (Novice) on Feb 25, 2014 at 05:35 UTC
    I'm getting this error now  Invalid or bad combination of options ('passphrase', 'key_path') at /srv/data203806/CPAN/localperl/lib/5.18.2/Net/SSH/Any/Backend/Net_OpenSSH.pm line 27. I'm not using system perl I have installed perl in another directory "srv/data203806/CPAN/localperl/lib" One more query. Are CPAN modules dependent on OS platform?
      Are CPAN modules dependent on OS platform?

      Not all CPAN modules work on every OS ... but most are designed to work on most systems.
      Net::SSH::Any is intended to work fine on both linux and windows - so it would be appreciated if you can provide the info that salva needs to sort out the problem.

      Cheers,
      Rob
      Show us your updated code!

      That message means you are passing the constructor options that are incompatile. For instance, the path to a private key and a password.

      It may also be a bug inside Net::SSH::Any but without seeing your code it is hard to tell.

      I'm getting the exact same error. I'm using cygwin. This error happens when using the new method. Here is my code that generates the error. $Fab2SwitchSSH = Net::SSH::Any->new( $fab2_ip, user => $fab2_userid, password => $fab2_password);
        Enable debugging in the module and post here the output:
        $Net::SSH::Any::debug = -1;

        Also, lots of bugs have been fixed in the development version (available from GitHub) of the module. You may like to give it a try. If you are using the Perl from Cygwin, the new Ssh_Cmd backend is probably your best option.

        I have not release it to CPAN because the Net::SSH2 backend is currently broken.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1076085]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-03-28 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found