after grep i want to redirect it to some variable

for the below

grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1

the result of the grep i want to redirect into some variable, i tried to do

veri=grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1

but it is not working

please help me in that

vari=$(your_command_here)

or

vari=`your_command_here`

second example uses backticks, google it to learn more.

enclose in back quotes.

veri=`grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1`