JavaScript has a function for this:
'world'.startsWith('w')
true
How can I test this with shell? I have this code:
if [ world = w ]
then
echo true
else
echo false
fi
but it fails because it is testing for equality. I would prefer using a builtin, but any utilities from this page would be acceptable:
http://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html