|
-
Ignore special characters in bash/expect script
Hi all, first of all, great forum, i have reading here a lot 
My question:
I'm trying to write script that part of is job is to do telnet session to switch with expect commands.
everything is ok except the password issu, my switches password is $toor, and $ is variable character, to resolve it, im writing it like that:
$\toor, the problem is in expect "\t" is also special characters :~, you know \t \r \n those are special characters in expect.
i tried 1000 of variation to how to write it right, i have tried $\toor , $\\toor , \$toor , \$\toor and other option but nothing have worked..
does anyone are know how to resolve it?
thats the command:
/usr/bin/expect -d <<EOF > cdp.txt
spawn telnet $switchip ;
expect "Username:" ;
send "root\r" ;
expect "Password" ;
send "$toor\r" ;
expect "#" ;
send "sh cdp neighbors detail $portnumber \r"
expect "#"
send "logout\n" ;
EOF
Thank you vry much, i have tried any possible variation, please help
Last edited by meirh; 01-03-2013 at 04:17 PM.
-
-
-
The Following User Says Thank You to old_bolvan For This Useful Post:
-
 Originally Posted by old_bolvan
Try "\\\$toor\\r"
Work lile a dream! thanks a lot!!
-
Similar Threads
-
By ehansen in forum Linux-Howtos
Replies: 16
Last Post: 02-12-2013, 09:05 AM
-
By News in forum Linux News
Replies: 0
Last Post: 03-06-2012, 01:14 AM
-
By News in forum Linux News
Replies: 0
Last Post: 01-26-2012, 10:19 PM
-
By Fred in forum Linux News
Replies: 0
Last Post: 01-10-2012, 10:21 AM
-
By Fred in forum Linux News
Replies: 0
Last Post: 01-10-2012, 09:51 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Check out Linux Central for Linux software and other goodies!
» Recent Threads
» Stats
Members: 3,588
Threads: 3,921
Posts: 9,451
Top Poster: Fred (1,486)
» Links
|
Bookmarks