RosettaCodeData/Task/Variable-size-Get/UNIX-Shell/variable-size-get.sh
2023-07-01 13:44:08 -04:00

5 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"