Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

scp script not working

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-22-2013
scriptscript scriptscript is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 16 November 2014, 9:00 AM EST
Posts: 75
Thanks: 21
Thanked 0 Times in 0 Posts
RedHat scp script not working

Hi all,

I am in the process of writing shell script to copy the files from one server to another.
Manually I have successfully copied the files from other server.

Now I am in the process of writing shell script for the same.
While browsing I had found the below script

Code:
#!/usr/bin/expect
        spawn scp  user@xx.x.x.x:/exceptions.csv destinationpath
        set pass "newpass"
        expect {
        password: {send "$pass\r"; exp_continue}
                  }

But on the execution of the below code I got the below errors

Code:
scptest.sh: line 2: spawn: command not found
couldn't read file "{": no such file or directory
scptest.sh: line 5: password:: command not found
scptest.sh: line 5: exp_continue}: command not found
scptest.sh: line 6: syntax error near unexpected token `}'
scptest.sh: line 6: `

Also I dont know what the "expect" and spawn means ?

Could anyone please help me out ?

Regards,
J
Sponsored Links
    #2  
Old Unix and Linux 03-22-2013
vbe's Unix or Linux Image
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 21 April 2015, 3:16 AM EDT
Location: Switzerland - GE
Posts: 6,026
Thanks: 182
Thanked 452 Times in 423 Posts
Next time open your own thread, Hijacking wont be tolerated...
(Moved to new thread...)
Sponsored Links
    #3  
Old Unix and Linux 03-22-2013
PikK45 PikK45 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 26 November 2014, 5:10 AM EST
Location: Chennai
Posts: 567
Thanks: 43
Thanked 74 Times in 72 Posts
Try this in your system which expect .
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SCP not working while SSH works posix Solaris 5 12-23-2011 08:54 AM
scp not working because of prompt (AIX, tcsh) lastZenMaster UNIX for Dummies Questions & Answers 1 07-24-2011 08:59 AM
ssh and scp not working jegaraman Solaris 4 01-06-2011 05:34 AM
scp not working while ssh works bakunin AIX 4 05-13-2010 02:19 AM
scp is not working through sh script Amit.Sagpariya Shell Programming and Scripting 8 03-10-2010 06:34 AM



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