~/ 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/5a7833c8-fff8-4ef9-b42d-acbcad733ef6/flashcard utf-8 LF