Well there are other issues with your command in that it includes other data than the number of lines. I will let you work out how to get rid of that, but
have a look at your favourite bash site about backticks (``) or $() features.
Clue: These are synonymous but one has the advantage of readability and negates the need for escaping in some circumstances