title: syntax error in bash "if.. elif" script
body: <p>I'm trying to build my first script to use "if" statements in bash. It combines 2 scripts that I got working to create multiple copies of a file, one with names appended numerically, the other using A-Z.</p>
  
  <p>I've tried many changes but I absolutely cannot get this to work without the error message</p>
  
  <blockquote>
    <p>./cpmany.sh: line 18: syntax error near unexpected token <code>elif'
    ./cpmany.sh: line 18:</code>elif [ $alpha="A" ]; then'</p>
  </blockquote>
  
  <p>Here is my original, non-working code:</p>
  
  <pre><code>#!/bin/bash
  set -x
  echo "input file source"
  read INPUT
  echo  "Alphabetical or Numerical"
  read alpha
  if [ $alpha=="N" ]; then
  echo "start of range"
  read x
  echo "end of range"
  read y
      for ((i=x; i&lt;=y; i++)); do cp "$INPUT" "$INPUT$i";
  elif [ $alpha=="A" ]; then
      for i in {a..z}
      do
      echo "$i"
      cp "$INPUT" "$INPUT$i";
  else
      echo "error in selection";
  fi
  exit 0
  </code></pre>
  
  <p>Here is my current code with added "done"s and spaces in the if [ $alpha = "N" ]</p>
  
  <pre><code>#!/bin/bash
  echo "input file source"
  read INPUT
  echo  "Alphabetical or Numerical"
  read alpha
  
  
  if [ $alpha = "N" ]; then
  echo "start of range"
  read x
  echo "end of range"
  read y
  
      for ((i=x; i&lt;=y; i++)); do cp "$INPUT" "$INPUT$i";
  done
  elif [ $alpha = "A" ]; then
      for i in {a..z};
      do
      echo "$i"
      cp "$INPUT" "$INPUT$i"; done
  else
      echo "error in selection";
  fi
  done
  exit 0
  </code></pre>