The Name Game: Difference between revisions
→{{header|UNIX Shell}}
(→{{header|UNIX Shell}}: Add implementation.) |
|||
Line 1,846:
This implements the required rules and also attempts to handle names that start with consonant clusters.
<lang sh>
namegame() {
local name=$1 b=b f=f m=m
local rhyme=${name#
while [[ $rhyme == [^
rhyme=${rhyme#?}
done
if [[ "$rhyme" == [AEIOU]* ]]; then
rhyme=$(tr A-Z a-z <<<"$rhyme")
fi
if [[ $name == [Bb]* ]]; then
b=
Line 1,866 ⟶ 1,870:
printf '%s!\n' "$name"
}
for name in Gary Earl Billy Felix Mark Frank; do
Line 1,878 ⟶ 1,883:
Gary!
Earl, Earl, bo-
Banana-fana fo-
Fee-fi-mo-
Earl!
Line 1,901 ⟶ 1,906:
Banana-fana fo-ank
Fee-fi-mo-mank
Frank!
</pre>
=={{header|VBA}}==
|