[clue-tech] Re: LUNA: Script for Unzipping?
Jef Barnhart
jef at batky-howell.com
Sun May 1 12:25:22 MDT 2005
On Sat, 30 Apr 2005 18:14:20 -0600
David Anselmi <anselmi at anselmi.us> wrote:
> Joseph A. Nagy, Jr. wrote:
> [...]
> > for i in `ls *zip`; do unzip "$i"; done
>
> Gads no! It's:
>
> for i in *zip; do unzip "$i"; done
>
> And realize that if *zip expands to a command line that's too long
> this will fail. (I tried to blow up bash on Linux recently and
> couldn't (though I did run out of memory) but with ksh on Solaris 8
> this is easy to do.)
>
> > That does the job admirably, now I just need to smack the heck out
> > of the unzip program (or the archive creators) for asking me,
> > repeatedly, if I want to overwrite txt files (I do) or rename ttf
> > files (I do). Hehe. :p
>
> How about -o? (You do have the man page, don't you?) And in case you
>
> don't want to overwrite fonts you can use -d to put stuff in an out of
>
> the way directory.
>
> Dave
Taking this on step futher.
I would use while instead of for. What if you have a file such as this,
"dos zipped files.zip"? for will choke on the spaces and fail.
files=`ls *.zip`
while ${files}; do
unzip ${f}
done
jef
More information about the clue-tech
mailing list