counting chars using bash
I'm fairly new to bash, and also I'm attempting to count the variety of chars in a documents. I created the adhering to function:
function chars(){
m=$(cat $1)
m=${#m}
echo $m
}
calling it with echo $(chars $2)
results on a documents the number 524, while calling wc -c
on the very same documents results 525. What creates the distinction? Just how can I get the very same outcome? (and also as a side inquiry - can I incorporate both first lines of my function right into one?)
3
elyashiv 2022-07-25 20:44:28
Source
Share
Answers: 0
Related questions