LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-16-2014, 04:58 PM   #1
mangal023
LQ Newbie
 
Registered: Nov 2013
Location: Chennai, India
Posts: 6

Rep: Reputation: Disabled
Need help with expect script


Hello,

I'm trying to test expect script which i have written. I'm using a ssh session connect. Below is my script:

#!/usr/bin/expect -f

spawn ssh "domain\username"@localhost
expect "?assword:"
send "$PWD\r"
expect "$"
send "date\r"
expect "$"
send "exit\r"


When i execute this script, I'm getting an output like this:

extra characters after close-quote
while executing
"spawn ssh "domain\username"@localhost
expect "?assword:"
send "$PWD\r"
expect "$"
send "date\r"
send "e..."


Can someone help me out...

Thanks
 
Old 05-16-2014, 08:53 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,676

Rep: Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455
I usually use autoexpect. Try it maybe.

Do those commands work correctly from shell?

Some ideas on a quite similar question. http://stackoverflow.com/questions/4...to-ssh-command

Last edited by jefro; 05-16-2014 at 08:54 PM.
 
  


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 09:06 PM
[root@fugo trace]# sh expect.sh expect.sh: line 9: expect: command not found sivaloga Linux - Kernel 1 08-22-2013 04:29 AM
[SOLVED] Problem in exporting variable from bash script to expect script uk.engr Linux - Newbie 3 06-14-2012 01:57 AM
[SOLVED] /usr/bin/expect : Script to check server load using both expect and bash Soji Antony Programming 1 07-27-2010 11:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:08 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