I want to count number of words from a String using Shell.
Suppose the String is:
input=\"Count from this String\"
Here the delimit
echo "$input" | wc -w
Use wc -w to count the number of words.
Or as per dogbane's suggestion, the echo can be got rid of as well:
wc -w <<< "$input"
If <<< is not supported by your shell you can try this variant:
wc -w << END_OF_INPUT $input END_OF_INPUT