-1

I am currently writing a program in the raspberry pi that will allow a user to enter a string, and have the program count the amount of letters in it. I am looking into expr but I don't know how to use it, and what this actually does. Could you let me know what this means and how I can use it for my program.

This is what I currently have.

#!/bin/bash
echo "Enter a word."
read str
"help here please!"

Thanks

1 Answers1

1

You could use this

expr length $str

Hopefully this should help!

Jas
  • 346
  • This, I have found, is a very longwinded answer compared to what val0x00ff has suggested. I much prefer to use what he has said as it makes things a lot easier. Thanks – Joe Dale Oct 16 '14 at 08:34
  • OK maybe next time, you decide whether you want to use 'expr' or not. Make it a bit clearer – Jas Oct 16 '14 at 08:36