SyntaxFix
Write A Post
Hire A Developer
Questions
I Would suggest the following:
var="any given string" N=${#var} G=${var//g/} G=${#G} (( G = N - G )) echo "$G"
No call to any other program