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

  • 2
    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 2:57
4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy