I am having trouble understanding following grep operation
a=jQuery.Uno echo $a | grep -i "jquerya*" why is above query returning jQuery.Uno?
The * quantifier matches 0 (zero) or more.
In the string, jQuery.Uno there is 0 a after y. As such, the regex jquerya* matches the string.
If you wanted one or more of a, then instead say:
grep -i "jquerya\{1,\}" or, if your version of grep supports extended regular expressions:
grep -iE "jquerya+" Moreover, instead of echo "$var" | grep ..., it is better to make use of herestrings if your shell supports those:
grep -iE "jquerya+" <<< "$a"