( Zahy | 2012. 07. 04., sze – 11:20 )

No ezt még rágnom kell, meg voltam győződve, hogy előbb történik a szavakra tördelés, és utána a különböző helyettesítáések. (sőt mi több a bash man-ja ezt explicit módon le is írja:


EXPANSION
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 substitu-
tion, arithmetic expansion, word splitting, and pathname expansion.

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

Mondjuk az első és a második bekezdés némileg ellentmond egymásnak. (*) Meg a fönti példád. Egyébként lőször azt akartam írni, hogy mihelyt 2 vagy több szóköz lesz a fájlnévben, már látszani fog, hogy rosszul mondod, ellenben kipróbálva akkor is jól működik, úgyhogy valaki elmagyarázhatná, mert nekem ez így nem kerek.

(*)Szerk. Nincs ellentmondás, később még ez is van:

The shell scans the results of parameter expansion, command substitu-
tion, and arithmetic expansion that did not occur within double quotes
for word splitting.

Szóval előbb szavakra tördel, után helyettesít, és amennyiben nincenek takarva, akkor a helyettesítések eredményét tovább tördeli. Akkor miért működik úgy, ahogy írtad?