Cross-Platform alternative to expr length
Instead of expr length 'keyword' you can use awk. An example would look like this echo 'keyword' | awk '{ print length }'

bounty:~ napcae$ echo 'keyword' | awk '{ print length }'  
7