I would like to store the output of a function (in that case the number of character given by wc
) into a variable. I can output the number of char as follows and it works
FILE=textfile.txt
wc -c < $FILE
However, I could not store the number of char into a variable as in the following example.
FILE=textfile.txt
nchar=${wc -c} < $FILE
echo nchar
How could I do it?