title: How to put a command in nohup in shell script?
body: <p>I am trying to put <code>shred</code> command in <code>nohup</code> for shell script, once the script is run it has to take input and run shred operation on a device in <code>nohup</code> mode. The problem is when I add <code>nohup</code> to command the script does not exit and run the command in background, also i am trying to send success and failure mails with the output once shred operation is completed.
  What I tried so far:</p>
  
  <pre><code>nohup shred -n 2 "device name" &gt; success.out 2&gt;failure.out
  if [$? -eq 0]
  then 
      mail -s "success" -a success.out "EmailID" &lt;.
      exit 0
  else 
      mail -s "failure" -a failure.out "EmailID" &lt;.
      exit 1
  fi
  </code></pre>
  
  <p>I am getting the success email with attachment n=but the attachment is non readable format, is there any other way??</p>