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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
expect help Smoker Shell Programming and Scripting 1 10-08-2008 02:26 PM
Any good tutorials or sites for expect scripting? rkruck Shell Programming and Scripting 4 08-27-2008 10:59 AM
Calling expect scripts from other expect scripts seva Shell Programming and Scripting 0 04-03-2008 02:45 PM
Help required on expect scripting ayyappakumar UNIX for Dummies Questions & Answers 1 05-29-2007 06:04 AM
Expect and auto expect command arun_v Shell Programming and Scripting 0 03-29-2006 08:31 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-30-2008
thepurple thepurple is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 134
expect scripting need help

Hi experts,

I am trying to develop a script using Expect. I am stuck somewhere. I need ur help guys.

I have sun solaris where i need to input the following commands-

bash-2.05$ telnet 11.13.58.39 2310
Trying 0.0.0.0...
Connected to ..
Escape character is '^]'.
CONNECTING TO...

PROCESS 2310 CONNECTED...

Enter command: LOGIN:user1:passwd1;
RESP:0;
Enter command: GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
RESP:0:Profile,01:MSI,987012365875:RIM,987012365875
Enter command: LOGOUT;
RESP:0;
Enter command: Connection to . closed by foreign host.
$


Now i want to made a ineterface for someusers in my solaris. The user will enjoy their own interface. To do this I changed the .profile of a username "john". And when john login he will see-

root@ircemaprod # su - john
Sun Microsystems Inc. SunOS 5.9 Generic May 2002
----------Welcome to Command Interface----------

Enter Command or type EXIT to exit
GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
RESP:0:Profile,01:MSI,987012365875:RIM,987012365875;
Enter command:

Enter Command or type EXIT to exit
EXIT


Now u see "command" comes twice. and "Enter command" prompt comes again. I don't want see those redcolor in my interface. How to do dear experts?? Please let me know if you need more info from me ?

Attached is .profile for user john and and expect script--
#!/usr/local/bin/expect -f

set timeout 180
set server [lindex $argv 0]
set ip [lindex $argv 1]
set user [lindex $argv 2]
set passwd [lindex $argv 3]
set cmd [lindex $argv 4]

log_user 0

spawn telnet $server $ip

expect "command: "
send "LOGIN:$user:$passwd;\r"

expect "command: "
log_user 1
send "$cmd\r"

expect "command: "
send "LOGOUT;\r"

exit
-----------
Attached Files
File Type: txt dot_profile.txt (400 Bytes, 24 views)

Last edited by thepurple; 12-01-2008 at 07:24 AM..
  #2 (permalink)  
Old 11-30-2008
Moon Noon Moon Noon is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 2
I don't really understand your question, could you make things easier for us to understand ?
  #3 (permalink)  
Old 12-01-2008
thepurple thepurple is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 134
Here is it-

I have unix server where i have a application for some special commands. Below way to entering in that application-

bash-2.05$ telnet 11.13.58.39 2310
Trying 0.0.0.0...
Connected to ..
Escape character is '^]'.
CONNECTING TO...

PROCESS 2310 CONNECTED...

Enter command: LOGIN:user1asswd1;
RESP:0;
Enter command: GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
RESP:0:Profile,01:MSI,987012365875:RIM,987012365875
Enter command: LOGOUT;
RESP:0;
Enter command: Connection to . closed by foreign host.
$


Now i want to make a ineterface for a user "john" in same machine where . User "john" will use the below ineterface. In fact, below ineterface will directly ineterct with above green colored ineterface. Whatever the command "john" will put the below ineterface- command will go to above mentioned application and show the response-

root@ircemaprod # su - john
Sun Microsystems Inc. SunOS 5.9 Generic May 2002
----------Welcome to Command Interface----------

Enter Command or type EXIT to exit
GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
RESP:0:Profile,01:MSI,987012365875:RIM,987012365875;
Enter command:

Enter Command or type EXIT to exit
EXIT

Now u see "command" comes twice. and "Enter command" prompt comes again. I don't want see those redcolor in my interface.
  #4 (permalink)  
Old 12-02-2008
gps1234 gps1234 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 3
IPV6 Shell Scripts

Can any one suggest me, How can I start write scripts to test IPV6 features
Closed Thread

Bookmarks

Tags
shell script, shell scripting, unix commands, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0