473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Is there a Perl command that exits out of Plink?

I have this problem across several Perl scripts. I have to use plink to ssh into a device. I am running Active Perl 5.10.0 Build 1004 on Windows Server 2003 with Putty release .056.

If I run the command this way:
Expand|Select|Wrap|Line Numbers
  1. $svctask = "plink.exe -ssh -l $user -i $svckey -2 $IP svcinfo lshost -delim :";
  2. @shstlist = qx ($svctask) or die "Unable to open SVC\n";
  3.     print "Enter a \n";
  4.     print "\t1) WWPN\n";
  5.     print "\t2) Server name\n";
  6.     print "\n\t ?";
  7.     do
  8.     {
  9.         chomp($choice = <>);
  10.         $choice = uc($choice);
  11.     }until($choice =~ m/[0-9]{1}/);
The script hangs and I can not make a choice. I have to CTRL C out which does me no good. If I move the plink command below the until statement, I am able to make a choice and the script continues until I have another pause for answer section and again it hangs. Is there a perl command that exits out of plink? I have used this same bit of code in other scripts that don't require SSH and it works just fine.
Mar 2 '11 #1
4 5095
miller
1,089 Expert 1GB
Random comment, but why not use cpan - Net::SSH?

- Miller
Mar 3 '11 #2
RonB
589 Expert Mod 512MB
That's what I suggested in the cross post.
http://perlguru.com/gforum.cgi?post=...=unread#unread
Mar 3 '11 #3
cpan - Net::SSH does not play well with the device I'm trying to SSH into because we have to use keys. We actually solved this by having the perl script write the command to a .cmd file and running it that way.
Expand|Select|Wrap|Line Numbers
  1.     open(MyFile,">","svc.cmd") or die "Unable to create file svc.cmd\n";
  2.     $svctask = "ECHO OFF\nplink.exe -batch -t -ssh -l $user -i $svckey -2 $IP svcinfo lshostvdiskmap -delim : $hostid";
  3.     print MyFile "$svctask";
  4.     close MyFile;
  5.     @svcvdisklist = qx ("svc.cmd") or die "Unable to open SVC\n";
  6.  
Mar 15 '11 #4
miller
1,089 Expert 1GB
Glad you found a workable solution, and thanks for sharing the followup.

- Miller
Mar 15 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: tpawona | last post by:
I'm writing a script that would be run by user oracle, that would logon to all the databases on the server. Thus I'll need to logon as sysdba. In Sqlplus, this would be sqlplus / as sysdba. How do...
10
by: Justin | last post by:
We have a simple shell script called testsp.sh (located at /home/ userid) Within the shell script, the following command is called: db2 -tvf callsp.sql When the shell script is run in command...
0
by: shanmugam | last post by:
Hi All How can i hide the command prompt window when executing the system command in perl. Thanks in advance Shanmugam
0
by: khushnuma | last post by:
Hi I need to be able to ftp a file from its current location to another folder in a different server. This has to be done as part of a perl script. Can anyone please tell me a command / script to...
4
by: jram01 | last post by:
Hi Folks, I am facing problem to to execute .sql command in sql prompt using perl script. I am able to connect sql promt using " my $odbcinput = "odbcinput.txt"; my...
3
by: zensunni | last post by:
I'm using this statement to create a trigger that auto-increments a table's primary key: CREATE OR REPLACE TRIGGER trigger BEFORE INSERT ON test REFERENCING NEW AS NEW FOR EACH ROW BEGIN...
1
by: Raju Sathliya | last post by:
Hi, I need to run Perforce command from perl script but it gives me error as per below: Can't locate P4.pm in @INC (@INC contains: C:\build\software\Perl\perl5.00402\lib\site ...... my perl...
8
blackgoat
by: blackgoat | last post by:
I have to run a command in unix. And I have to match this expression from whatever output I get. I tried doing the following: my $var = 'command'; my ($exp) = $var =~ m/pattern/; The same is...
2
by: Selva123 | last post by:
Hi All, Greetings. May be simple issue but your help sought. I am executing the system command like $res=system("notepad.exe"); thro a perl file named aa.pl. At command prompt - when I enter ...
2
by: Selva123 | last post by:
Hi All, Greetings. May be simple issue but your help sought. I am executing the system command like $res=system("notepad.exe"); thro a perl file named aa.pl. At command prompt - when I enter ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.