Bash Scripting - String Operations
How can you get the length of the first word in a string variable
line="hello world" using bash string length?line="hello world" using bash string length?${line%% *} removes longest match of space and after, leaving first word.${#line%% *} gives length of first word.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions