( Xanco | 2024. 05. 17., p – 00:29 )

Idézet a bash man page expansion fejezetéből:

       Expansion  is  performed  on  the  command line after it has been split into words.  There are seven
       kinds of expansion performed: brace expansion, tilde expansion, parameter  and  variable  expansion,
       command substitution, arithmetic expansion, word splitting, and pathname expansion.

       The  order  of  expansions  is:  brace expansion; tilde expansion, parameter and variable expansion,
       arithmetic expansion, and command substitution (done in a left-to-right  fashion);  word  splitting;
       and pathname expansion.

A $opts behelyettesítése az a "parameter and variable expansion", majd később a .* feloldása a legvégén a "pathname expansion" fázisban történik. Ez utóbbitól a quoting vagyis az időjelezés (beleértve a macskakörmöket is) tudja megvédeni a(z akár behelyettesített) szöveget is. A tömb "${array[@]}" formában való használata esetén a kiértékelés (expansion) során a helyére beillesztett egyes tömb elemek úgy kerülnek behelyettesítésre, mintha maguk is idézőjelezve lettek volna: "${array[0]}" "${array[1]}" ... Ilyenformán a $opts ".*" eleme beillesztve védett lesz a "pathname expansion" során és nem kerül feloldásra/kiértékelésre, mint "glob pattern".