Review the Shell Script

Hi,

I want to copy all the log file except current date log from one server to another server.

Log File will be like this LOGNIG_08_11_2008*.log

For this
cd /test/log
date -d '1 day ago' "+%d_%m_%Y" -->This command gives previous day
scp LOGSNIG_date -d '1 day ago' "+%d_%m_%Y" 10.13.54.69/test/LOG_BKP

I am getting error when i execute this No Such file or directory ....

Can anyone help in this.

Regards Srini

The shell has no way of knowing which part of LOGSNIG_date -d '1 day ago' "+%d_%m_%Y" is a command and which part is a filename. To insert the output of a command into the command-line you need to use either $( ... ) or ` ... `. Also you need a colon between the destination hostname and destination directory. Try this:

scp LOGSNIG_$(date -d '1 day ago' "+%d_%m_%Y") 10.13.54.69:/test/LOG_BKP

Thank you very much for your support. I resolved the issue.