LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-21-2011, 02:19 AM   #1
f4dleep
LQ Newbie
 
Registered: May 2011
Posts: 2

Rep: Reputation: Disabled
How to send '}' in expect?


Hi,

I'm trying to use expect to get data from telnet

Here's my code :
Code:
set equipment [lindex $argv 0]
set trunk [lindex $argv 1]
set fraction [lindex $argv 2]

set user1 "rnanaha8"
set pass1 "anggur#1"
set user2 "rzulkif8"
set pass2 "Abyan_2011"

spawn ssh rnanaha8@10.2.81.116
expect "*word*" { send "$pass1\r" }
expect "*$user1*" { send "telnet 10.105.224.68\r" }
expect "*ogin*" { send "$user2\r" }
expect "*asswor*" { send "$pass2\r" }
expect "*ANCB*" { send "gsh get_e1t1_frac -eq {$equipment} -trunk $trunk -frac $fraction\r" }
expect "*ANCB*" { send "exit\r" }
expect "*$user1*" { send "exit\r" }
expect eof
but this get error

Build label: NDPGSN_5_0_SRC_GSN_LINUX_4R1D01
Build host: selnx056
Build date: Thu Feb 19 20:50:48 MET 2009
Installed: Sat Dec 19 11:32:38 UTC 2009

=== rzulkif8@eqm01s13p2 ANCB ~ # gsh get_e1t1_frac -eq {2 6 1 1
Missing }.
=== rzulkif8@eqm01s13p2 ANCB ~ # } -trunk 3
}: Command not found.
=== rzulkif8@eqm01s13p2 ANCB ~ # -frac 16
-frac: Command not found.

=== rzulkif8@eqm01s13p2 ANCB ~ #
=== rzulkif8@eqm01s13p2 ANCB ~ # exit
logout
================================================

so in bold letter not send in 1 line, but i want sent it to 1 line

thank's for your suggestion
 
Old 05-21-2011, 07:30 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
I don't know, but it looks to me like the '}' after '$equipment' is confusing it... Perhaps you could try escaping it?
 
Old 05-24-2011, 08:26 PM   #3
f4dleep
LQ Newbie
 
Registered: May 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
dear Snark1994.

thank you for your suggestion
I've try escaping it, but still command not send in 1 line

any idea ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 10:06 PM
A question about using expect and send thomas2004ch Linux - Software 5 03-29-2011 09:27 AM
TCL - Expect -- IF results Are different Then send a command ritztech Programming 1 12-11-2010 05:55 PM
[SOLVED] How to send '/' in expect? waymanise Programming 3 08-18-2010 09:18 AM
[Expect scripting] send problem ldp Programming 1 01-24-2005 03:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration