title: Cron doesn't accept bash syntax
body: <p>I have a bashscript that I'm running with crontab.  Unfortunately, a script that works fine when run manually fails with the error: </p>
  
  <p><code>Syntax error: "(" unexpected (expecting "}")</code></p>
  
  <p>Where the line in question is line 22 which is:</p>
  
  <p><code>declare -a PREV_TOTAL=( $(for i in ${range[@]}; do echo 0; done) )</code> </p>
  
  <p>In the larger context:</p>
  
  <pre><code>TOTAL_CPU_USAGE=0
      TOTAL_CPU=$(grep -c ^processor /proc/cpuinfo) #set number of CPUs to check for
      declare -a 'range=({'"0..$TOTAL_CPU"'})'
      let "TOTAL_CPU=$TOTAL_CPU - 1"
  
      #declare array of size TOTAL_CPU to store values (eg. 8 cpus makes arrays of size 8)
      declare -a PREV_TOTAL=( $(for i in ${range[@]}; do echo 0; done) )
      declare -a PREV_IDLE=( $(for i in ${range[@]}; do echo 0; done) )
  </code></pre>
  
  <p>This works when manually just fine, but I don't understand what I'm doing wrong that causes cron to give this error?  If you know I'd be very appreciative.  Thanks.</p>
  
  <p>EDIT: My crontab looks like this:</p>
  
  <pre><code># m h  dom mon dow   command
  SHELL=/bin/bash
  @reboot cd /home/ubuntu/waste-cloud-computing/probe &amp;&amp; probe.sh &gt;&gt; /var/log/somelogfile.log 2&gt;&amp;1
  </code></pre>
  
  <p>And I access it with <code>sudo crontab -e</code>.  I'm still getting the issue while providing the SHELL variable.</p>
  
  <p>EDIT 1: Thanks to some help I got past the syntax issues by ensuring the shell was using bash.  Now I get the error, <code>/bin/bash: probe.bash: command not found</code>.  I assume its some kind of PATH issue, but <code>which bash</code> returns <code>/bin/bash</code> so it seems normal to me.  Maybe someone knows what's up?</p>