title: A bash script to reverse the array
body: <p>Here is the code that I tried</p>
  <pre><code>#!/bin/bash
  echo &quot;Enter the size of array: &quot;
  read s
  echo &quot;Enter the elements of array: &quot;
  for (( i=0; $i&lt;$s; i++ ))
  do
      read a[$i]
  done
  j=`expr $s - 1`
  for (( i=0; $i&lt;$j; i++ ))
  do
      temp = ${a[$i]}
      a[$i] = ${a[$j]}
      a[$j] = $temp
      j = `expr $j - 1`
  done
  
  echo &quot;The reverse array is&quot;
  for (( i=0; $i&lt;$s; i++ ))
  do
      echo ${a[$i]}
  done
  </code></pre>
  <p>And I'm getting the following errors</p>
  <pre><code>/home/2.sh: line 12: temp: command not found
  /home/2.sh: line 13: a[0]: command not found
  /home/2.sh: line 14: a[2]: command not found
  /home/2.sh: line 15: j: command not found
  /home/2.sh: line 12: temp: command not found
  /home/2.sh: line 13: a[1]: command not found
  /home/2.sh: line 14: a[2]: command not found
  /home/2.sh: line 15: j: command not found
  </code></pre>
  <p>I was trying to swap the first element with the last element and so on, but the error says temp command not found. What am I doing wrong here?</p>