echo *.c
in bash, treats the argument as a constant and prints *.c
. How to force it to consider it as a glob
pattern and print the list of files/folders ending with .c?
echo *.c
in bash, treats the argument as a constant and prints *.c
. How to force it to consider it as a glob
pattern and print the list of files/folders ending with .c?
Either you have nothing in your current directory that match your globbing pattern (then the pattern will stay as it is), or you have disabled globbing by shell option -f
(or set -o noglob
).
.c
, sobash
left the pattern unchanged toecho
. You can setshopt -s failglob
to report error if pattern didn't match. – cuonglm Mar 23 '15 at 02:57