The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
what are some different commands in c shell and korn shell?? EquinoX UNIX for Dummies Questions & Answers 1 01-28-2008 08:14 PM
tsh shell to korn shell arifkhan AIX 7 05-07-2007 01:01 PM
bourne shell or korn shell? XZOR UNIX for Dummies Questions & Answers 2 10-05-2006 11:34 PM
How to run unix commands in a new shell inside a shell script? hkapil Shell Programming and Scripting 2 01-04-2006 02:56 AM
how to convert from korn shell to normal shell with this code? forevercalz Shell Programming and Scripting 21 11-22-2005 10:18 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-16-2005
Registered User
 

Join Date: Aug 2003
Posts: 252
Question KORN Shell - Spawn new shell with commands

I want to be able to run a script on one server, that will spawn another shell which runs some commands on another server..

I have seen some code that may help - but I cant get it working as below:


spawn /usr/bin/ksh
send "telnet x <port_no>\r"
expect "Enter command: "
send "LOGIN:x:x; \r"
expect "Enter command:"
send "LOGOUT; \r"
close

but this errors - I may be missing code etc, I honestly dont know. Can anyone help me? Or is there another way to do this?
I dont want to execute a script on the other server, I want to log on to it and type some commands, get the response and log off... Please note I log on to server on a specific port - this is not telnet.

Any help would be appreciated.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-16-2005
kduffin's Avatar
UN1X
 

Join Date: Nov 2003
Location: Virginia
Posts: 441
Do you have 'expect' installed and have it defined as the interpreter? The following should be at the top of your script (path may vary).

#!/usr/local/bin/expect

Cheers,

Keith
Reply With Quote
  #3 (permalink)  
Old 04-20-2005
Registered User
 

Join Date: Aug 2003
Posts: 252
Doh! Should have seen that...

I have expect installed - just didnt have it as the interpreter in the script...
Thanks!!!
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0