答え1
そしてzsh
:
#! /bin/zsh -
words=(foobar foobarbaz STRING)
strings=(fbr STRN xyz)
vowels=aeiouAEIOU # adjust as needed
typeset -A matches=()
for word ($words) {
word_without_vowels=${word//[$vowels]}
for string ($strings)
if [[ $word_without_vowels = $string* ]] matches[$string]+=" $word"
}
for string ($strings)
if (( $+matches[$string] )) print -r -- "$string:$matches[$string]"
以下を提供します。
fbr: foobar foobarbaz
STRN: STRING