title: using EOF in bash script
body: <p>I am Using AMBER to simulation molecular system. In AMBER there is a module to analyse data called "cpptraj". </p>
  
  <p>Normally I use the command in bash script as below:</p>
  
  <pre><code>#!/bin/bash
  
  
  path="../Production-from-gpu"
  system="maltoLyo-23per" 
  top="maltoLyo23per.top" 
  alltraj="md-product.center.reimage-all.traj" 
  outtraj="maltoLyo-23per-reimage" 
  
  
  cpptraj $top &lt;&lt; EOF
  
  
  trajin  ../$system-MD001-run0100.traj 1 100 5 
  trajin  ../$system-MD001-run0200.traj 1 100 5 
  trajin  ../$system-MD001-run0300.traj 1 100 5 
  trajin  ../$system-MD001-run0400.traj 1 100 5 
  trajin  ../$system-MD001-run0500.traj 1 100 5 
  trajin  ../$system-MD001-run0600.traj 1 100 5 
  trajin  ../$system-MD001-run0700.traj 1 100 5 
  trajin  ../$system-MD001-run0800.traj 1 100 5 
  trajin  ../$system-MD001-run0900.traj 1 100 5 
  trajin  ../$system-MD001-run1000.traj 1 100 5 
  
  trajout abc.traj mdcrd
  
  EOF
  </code></pre>
  
  <p>I find no problem running this script.</p>
  
  <p>Now I want to use "for" loop in this script, like,</p>
  
  <pre><code>#!/bin/bash
  
  
  path="../Production-from-gpu"
  system="maltoLyo-23per" 
  top="maltoLyo23per.top" 
  alltraj="md-product.center.reimage-all.nc" 
  outtraj="maltoLyo-23per-reimage" 
  
  
  
  cpptraj $top &lt;&lt; EOF
  
  for i in {0..5};do
  
  if [[ ($i -ge 0) &amp;&amp; ($i -lt  10) ]]; then
  
  
  trajin  $path/$system-MD00i-run0100.traj 1 100 5 
  trajin  $path/$system-MD00i-run0200.traj 1 100 5 
  trajin  $path/$system-MD00i-run0300.traj 1 100 5 
  trajin  $path/$system-MD00i-run0400.traj 1 100 5 
  trajin  $path/$system-MD00i-run0500.traj 1 100 5 
  trajin  $path/$system-MD00i-run0600.traj 1 100 5 
  trajin  $path/$system-MD00i-run0700.traj 1 100 5 
  trajin  $path/$system-MD00i-run0800.traj 1 100 5 
  trajin  $path/$system-MD00i-run0900.traj 1 100 5 
  trajin  $path/$system-MD00i-run1000.traj 1 100 5 
  fi
  
  
  trajout abc.traj mdcrd
  ##############################################
  
  
  done
  EOF
  </code></pre>
  
  <p>I find this code can not be executed. I get error message like:</p>
  
  <pre><code>vijay@glycosim:/media/glycoExtra/TRAJECTORY-lyotropic-system300ns/maltoLyo-C12-23per/Select-traj-using-cpptraj$ ./generate_traj_select_script.sh
  
  CPPTRAJ: Trajectory Analysis. V13.15
      ___  ___  ___  ___
       | \/ | \/ | \/ | 
      _|_/\_|_/\_|_/\_|_
      AmberParm Title: [default_name]
      Radius Set: modified Bondi radii (mbondi)
  INPUT: Reading Input from STDIN
    [for i in {0..5};do]
  [for]: Command not found.
  
  vijay@glycosim:/media/glycoExtra/TRAJECTORY-lyotropic-system300ns/maltoLyo-C12-23per/Select-traj-using-cpptraj$ 
  </code></pre>
  
  <p>How I can make this script to run without problem? Appreciate any help in advance.
  Thank you.</p>