title: I am trying to send mail which will redirect the content of log files in logfile.txt in same directory.But its failing
body: <p>Please find my script below:-</p>
  
  <pre><code>#!/bin/bash
  date=`date +%Y%m%d`
  
  ssh root@server-ip  "ls -lrth /opt/log_$date/"
  
  ssh root@server-ip  "cd /opt/log_$date/; for i in `cat *.log`;do echo $i &gt;&gt; /opt/log_$date/logfile.txt; done;cat  /opt/log_$date/logfile.txt| mail -s \"Apache backup testing\" saranjeet.singh@*****.com"
  </code></pre>
  
  <p>Any help will be appreciated. Thanks</p>