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: 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 03-22-2013
vbe's Avatar
vbe vbe is online now Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 18 December 2014, 12:05 PM EST
Location: Switzerland - GE
Posts: 5,975
Thanks: 171
Thanked 439 Times in 411 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: 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 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 09:54 AM
scp not working because of prompt (AIX, tcsh) lastZenMaster UNIX for Dummies Questions & Answers 1 07-24-2011 09:59 AM
ssh and scp not working jegaraman Solaris 4 01-06-2011 06:34 AM
scp not working while ssh works bakunin AIX 4 05-13-2010 03:19 AM
scp is not working through sh script Amit.Sagpariya Shell Programming and Scripting 8 03-10-2010 07:34 AM



All times are GMT -4. The time now is 01:20 PM.