scp script not working | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

scp script not working

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-22-2013
scriptscript scriptscript is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 30 January 2014, 11:03 AM EST
Posts: 74
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 03-22-2013
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 17 April 2014, 3:54 AM EDT
Location: Switzerland - GE
Posts: 5,490
Thanks: 148
Thanked 362 Times in 339 Posts
Next time open your own thread, Hijacking wont be tolerated...
(Moved to new thread...)
Sponsored Links
    #3  
Old 03-22-2013
PikK45 PikK45 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 7 February 2014, 8:50 AM EST
Location: Chennai
Posts: 560
Thanks: 41
Thanked 72 Times in 70 Posts
Try this in your system which expect .
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 07:43 PM.