myArray=('Prasanth' 'kumar' 'guru')
Is it possible to get element which ends with "santh" without iterating the array(myArray) with bash.
My expected output is to get Prasanth without iterating the above array, just by checking wildcard like ('santh')and get the element.
I suggest:
printf '%s\n' "${myArray[@]}" | grep 'santh$'
Output:
Prasanth
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With