title: Bash: illegal variable name error
body: <p>I am trying to extract a field from a text file using grep. I want to store the line number into a bash variable for later, but I am getting an illegal variable name error. This is part of my script:</p>
  
  <pre><code>#!/bin/csh
  
  set echo
  
  grep -n -m 1 "HR${4}" Tossed/length${1}/TL${1}D2R${2}-${3}TT.txt | cut -d : -f 1
  
  To_Start=$((grep -n -m 1 "HR${4}" Tossed/length${1}/TL${1}D2R${2}-${3}TT.txt | cut -d : -f 1))
  </code></pre>
  
  <p>This is the output:</p>
  
  <pre><code>[maurerj1@rucc-headnode Tenengolts_Generate]$ ./flow_LBBH.sh 7 0 0 0
  grep --color=auto -n -m 1 HR0 Tossed/length7/TL7D2R0-0TT.txt
  cut -d : -f 1
  1                          #This is the right number
  Illegal variable name.     #why is this not working?
  </code></pre>
  
  <p>From what I've read, uppercase, lowercase and underscores are allowed in bash variable names, so what am I doing wrong?</p>