I am writing a basic bash script to iterate through an array and I have to output the words starting with the letters 't' and 'm'. I used grep to obtain the words starting with certain letters, but I am unable to output more than one letter. How do I use grep to search for more than one starting letter? Or is there a better way to approach this?
#!/bin/bash
Unix=( "car" "hello" "tony" "mustard" );
echo ${Unix[@]}
echo "Here are the words starting with t + m: "
for i in ${Unix[@]}
do
echo $i | grep '^\t'
done