How to make a variable out of the output of a unix command? -
i'm trying have variable $totallines stores total lines in file (given input $1).
i'm trying this:
totallines= grep -c *.* $1
but unix doesn't that.
i've tried enclosing in paranthesis, square brackets, , (), doesn't work either. has got super simple i'm searching answer around web , not finding page or forum states it.
sorry trouble guys such easy one.
there 2 ways achieve it:
totallines=$(grep -c *.* $1)
or
totallines=`grep -c *.* $1`
Comments
Post a Comment