linux counting characters then output number of characters in a string entered by user and it also needs a while loop -


i have been trying linux count characters in string , out put them want user able enter string , amount of characters in string outputed have limited understanding of linux need thank you!

so far have got this:

#!/bin/bash  x="this test"  y="${x//[^s]}"  echo "$y"  echo "${#y}" 

but 1 type of character , it's not in while loop allow user quit if wan if can appretiated

an example input "i pie" want program output "the string have entered has 10 characters

you can use read input user , use ${#var} length:

#!/bin/bash  read -p "enter input text: " input echo "# of chars in input: ${#input}" 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -