I have a directory that has 800 files like this:
file1.png
file1@2x.png
file2.png
file2@2x.png
file3.png
file3@2x.png
... etc
I need to create zip files like this
file1.zip (containing file1.png and file1@2x.png)
file2.zip (containing file2.png and file2@2x.png)
file3.zip (containing file3.png and file3@2x.png)
Is there a magic command I can use to do that?
bash
version you use? Mine is 4.2.37. – manatwork Nov 20 '12 at 15:48extglob
is not enabled by default in interactive shells, but maybe your OS ships with abashrc
that turns it on (and extglob has been added to bash in 2.02-alpha1) – Stéphane Chazelas Nov 20 '12 at 21:25extglob
setting.extglob
defaults to whatbash
configure
's--enable-extended-glob-default
switch indicated. And that switch is “enabled by default, unless the operating system does not provide the necessary support”. This may be the difference between Linux and OSX behavior. – manatwork Nov 21 '12 at 07:39--enable-extended
is enabled by default (opt_extended_glob=yes
inconfigre
), but not--enable-extended-glob-default
(opt_extglob_default=no
), that's an inaccuracy in the documentation. It must have been explicitly enabled by your OS maintainer. But point taken about different bash distributions having different defauts. – Stéphane Chazelas Nov 21 '12 at 08:19