If I store a long string in a variable and you need to check if the string starts with the letters abc, what would be the most efficient way to check this?
Of course, you can repeat the line and pass it to grep / awk / sed or something like that, but is there a more efficient way (which does not require scanning the entire line?)?
Can I use the case statement for this, for example, for example.
case $var in
^abc) doSomething;;
esac
?
Cheers, Oliver
source
share