I put together a script to do some file operations for me. I am using the wild card operator * to apply functions to all files of a type, but there is one thing I don't get. I can unzip all files in a folder like this
unzip "*".zip
However, to remove all zip files afterward, I need to do
rm *.zip
That is, it does not want the quotation marks. The unzip, on the other hand, does not work if I just give it the * (gives me a warning that "files were not matched").
Why is this different? To me, this seems like the exact same operation. Or am I using the wild card incorrectly?
Introductions to the wild card in Unix do not really go into this, and I could not locate anything in the rm or zip docs.
I am using the terminal on a Mac (Yosemite).
unzipcould do this without the normalfor f in *.zip;do...doneshell loop. Such a weird non-unix-like command line UI. – Peter Cordes May 22 '16 at 18:49unzipapplies the glob to the contents of an archive; you cannot get them from bash with a wildcard. (You'd need ```for f inunzip -l archive.zip; do ... done`) – alexis May 23 '16 at 10:50unzipaccepting globs to match inside a single zip file. But this is different; I actually triedunzip '*.zip'in a directory with multiple zip files, and it extracts all files from all zips. Like I said, super-weird.tardoesn't have any mode of operation like that. – Peter Cordes May 23 '16 at 11:12