--- bascule <[EMAIL PROTECTED]> wrote: > i have a stack of roms for xmame that are in zip > format and xmame won't > recognise them (though i thought it would) i want to > unzip each to a > directory of the same name minus the .zip extension, > however the default for > unzip is to extract into the current directory, i > can't get the -d option to > work with a variable, how do i do this, the > following is what i have come up > with so far: > [root@mycroft xroms]# for file in *;do set > base=basename $file .zip; unzip > $base -d $base;done > > i get errors about using the -d option for unzip! > > of course, any elegant solutions for this are > welcome! > > bascule > Sorry, not familiar with unzip syntax. However, a couple of comments on your script that might help. Firstly, never safe to just do * like that, as there may be other files there that you DON'T want processed. Far better to use backquotes and the ls command, viz: for file in `ls *.zip` Secondly, if the -d option isn't working, how about doing this: for each file, create a unique subdirectory, move the zip file there, go there and run the unzip there. Script might look like: for file in `ls *.zip` do set base=basename_$file mkdir $base mv $file $base cd $base unzip $file (or whatever the syntax is) cd .. done Not elegant, but simple (I'd test it first on a couple of files copied somewhere safe to play). Elegance is over-rated if it means impossible to understand oneliners that try to do everything! Hope this helps, Ron. __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
