~/ learn/ comp-325/ cards/ Asterisk, question mark, and who actually expands them
1 of 9

Prove that the shell, not the command, does the expanding

Prove that the shell, not the command, does the expanding

Answer

echo *.c ls *.c ls "*.c"

echo knows nothing about files, yet prints the three names — so the shell produced them. The quoted third line hands ls a literal one-argument name and gets "No such file or directory" back.

Sarwar & Koretsky 3e ch2 §2.9; ch4 §4.5.2

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/ee4c85a1-06c2-44dd-87ea-a33d70722625/flashcard utf-8 LF