6 lines
256 B
Bash
6 lines
256 B
Bash
|
|
# In the shell all variables are stored as strings, so we use the same technique
|
||
|
|
# as for finding the length of a string:
|
||
|
|
greeting='Hello, world!'
|
||
|
|
greetinglength=`printf '%s' "$greeting" | wc -c`
|
||
|
|
echo "The greeting is $greetinglength characters in length"
|