I can't store value in the variable

!#bin/bash
clear
var= grep @gmail.com email.txt | wc -l
echo $var
echo $var
exit 0
OUTPUT:
1000
_
_

Where _ represent space (no value or nothing)

Corrections:

#!/bin/bash

clear
var="$( grep -c @gmail.com email.txt )"

My whole command is not working with "$( )' method of yours

Show exactly what you did, word for word, letter for letter, keystroke for keystroke. Your first try put a space between the = and the expression, which is wrong.

In addition to what Corona688 said, please also explain what

means?

Did it produce no output? Did it print any diagnostic messages? (If so, please show us the exact output you received in CODE tags.)

What shell are you using? What operating system are you using?