Michael Conlen wrote:

Constantine wrote:

I am writing a script, which involves unzipping some files. I would have to unzip 4 different zip-files from some directory, and I would need to unzip them to the directory, which would have the same name in it as the original zip-file, i.e. I would like to run something like "ls *.zip", have each file name recorded in some variable, and do a loop like "unzip $filename[$i] -d $filename[$i].unzipped/". Can someone help me with the code? How can I put the results of a command to a variable?

If I understand you properly I think the following would do what you want

for i in `ls *.zip`
unzip ${i} -d ${i}.unzipped

Thank you very much indeed! Seems just what I wanted. But can I save the archive names in an array for further manipulation? Also, how can I type that apostrophe ` from my keyboard?


[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to