5
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?

  • 3
    Your current directory doesn't contain any files/directory ending with .c, so bash left the pattern unchanged to echo. You can set shopt -s failglob to report error if pattern didn't match. – cuonglm Mar 23 '15 at 02:57

1 Answers1

5

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).

Janis
  • 14,222