count the input characters in bash