It sounds like you used quotes instead of backticks.
Originally Posted by elfstone214
The difference is subtle, which leads to some frustrating misunderstandings when reading or copying a script. The backticks are instructions to the shell to run a command in a sub-shell. The output of the sub-shell command is returned and can be assigned to a variable. In this case, the variable name was assigned the output of : grep case file.txt
This type of backtick substitution is useful, and used fairly often in shell scripting. Be aware that grep returns nothing if there is no match, and multiple values if there are multiple matches. Because of that, consider:
This block of code will read the first line of the file, and then check whether or not name recieved an assignment.
name=`head -n 1 file.txt`
if [ -z $name ]; then