I have a bunch of LaTeX files on my Desktop:

ma 512 hw 11.log, ma 512 hw 11.aux, ma 512 hw 11.tex


I want to use brace expansion to print them to the Terminal. E.g.,

ls *.{log, aux}

But when I try to give this command, I get the following errors:

ls: *.{aux,: No such file or directory
ls: log}: No such file or directory

So clearly it's not doing the brace expansion. What am I missing?

enter image description here

[I'm using Bash 3.2.51 on OS X 10.9.2]

EDIT: I thought it might be a problem with the fact that the files have spaces in their names, but when I tried it again with a no-space name, the same thing happened (see image).

enter image description here


Never mind, I figured out the problem. You can't put spaces between aux and log because bash splits on spaces. (Duh!)

This works:

ls *.{aux,log}

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.