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

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -