string='Hello, world!' length=${#string} echo $length # if you want it printed to the terminal