Back quote problem

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:
    Print out problem with line follow:
echo There are '$cat $fname | wc -l' contacts in database

how do I replace single quote with a backquote from Vi or nano?

  1. Relevant commands, code, scripts, algorithms:
#!/bin/bash

#export all output to fname

fname=names.dat

echo "Please Enter your contact name as follow:"

echo "Given name: "
read name

echo "Surname: "
read surname

echo "Street address"
read street

echo "City you live in"
read city

echo "States"
read states

echo "Zip code"
read zipcode

echo $name   $surname   $street   $city   $states   $zipcode >> $fname

{
 echo
 echo Here are the current contacts in the database:
 echo
 cat $fname

} | more

echo There are "$cat $fname | wc -l" contacts in database
  1. The attempts at a solution (include all code and scripts):
There are  names.dat | wc -l contacts in database

My attempt to printout how many users in database

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    This does not relate to my school work.. Addition info that I learn from my own.

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Since you are using bash rather than a pure Bourne shell, why not use:

$(cat $fname | wc -l)

or, much better,

wc -l < "$fname"

instead of:

`cat $fname | wc -l`

?

If you must use backquotes, on most US keyboards, the backquote ( ` ) and tilde ( ~ ) characters are on the key to the left of the key with 1 (unshifted) and ! (shifted).

Thank you.