I created an SMS autoresponder script, currently it allows all phone numbers to be replied from my machine, now I want to filter only a specific phone number, so when other phone numbers that are not in the list, my machine ignores it.
#!/bin/bash
PhoneNumberFilter="yes"
PhoneNumber[0]="08123"
PhoneNumber[1]="08321"
PhoneNumber[2]="12345"
MyPhoneNumber="08321"
echo "My phone number is: $MyPhoneNumber"
echo "all numbers: ${PhoneNumber[@]}"
if [[ "$PhoneNumberFilter" == "yes" ]] && [[ *"$MyPhoneNumber"* == "${PhoneNumber[*]}" ]]; then
echo "it works"
echo "My phone number is in the list of arrays"
echo "Send SMS to my phone number only"
else
echo "it doesn't work, my phone number is not in the list"
echo "ignore it"
fi
How do I display the it works
part? when I execute that script it always displays the it doesn't work
part.