I have this assignment to make the following script:INPUT:
./<scriptname> number1 number2 number3 number4PROCESSING:
Look up all the possible combinations in /usr/share/dict/words while you replace '2' with an a, b or c, '3' with d, e or f,... like in a cellphoneOUTPUT:
Show matches or errormessage if no match
Sor far I have come up with this:
if [[ $# -lt 1 ]]
echo "No input was given. Please enter some numbers."
while [[ $# -gt 0 ]]; do
if [[ $1 =~ [^2-9] ]]
echo "Invalid input ($1). Only numbers between 2 and 9 are allowed."
But I'm having a lot of trouble finding out how to do the actual conversion from the numbers to the letters and searching them in the word list, that is without a ridicoulously long if-then-else-structure.
Note: as you might suspected by now, my level in shell scripting is very basic