I have two servers A and B(remote server) ,need to copy files from A to B remote server . before copy i need to remove the files in the remote server depends on my input variable from local server .
For copy command
scp -r file test@host:/home/test/$name1/$name2.pdf
here $name1 and $name2 are the variables getting from local machine , values will vary
above command works fine
For move command
if [ "$name1" = "RAM" ]
then
ssh test@host 'mv /home/test/$name1/*.pdf /home/test/$name1/backup'
this is not working
can you please suggest me how to archive this.
ifstatement is missing an endingfi. I hope it's just a part of your code i.e original code contains an endingfi...