You can't do it without actually unzipping the top files in a sub-folder.
Something like this:
set -e
for f in *.zip
do
n=`basename -- "${f}" .zip`
mkdir -- "${n}"
cd -- "${n}"
unzip ../"${f}"
for p in *.zip
do
unzip -l -- "${p}"
done
cd ..
rm -rf -- "${n}"
done
You should probably verify whether ${n} already exists and if so generate an error. You could also use a temporary filename for the sub-directory:
dir=`mktemp -d zip-files.XXXXXX`
Then do cd "${dir}" and rm -rf "${dir}" once done.
Updates:
The set -e is used to make sure that if something goes wrong then the script stops. Especially, if the mkdir -- "${m}" fails, the cd -- "${m}" will fail too and thus the cd .. would get you at the wrong directory level and that's where the rm -rf -- "${n}" becomes dangerous.
Another way to make the cd .. statement safer is to memorize that directory before the for loop and use that path like so:
topdir=`pwd`
for ...
do
...
cd "$topdir" # instead of `cd ..`
...
done
That way the rm -rf -- "${n}" will only operate in $topdir.
The use of the temporary directory will also make things a lot safer since that way whatever the filenames in the top zip file, the directory creation/removal will work as expected.
unzipdoes nothing (it puts some stuff on the output, but that is not used). The 2nd for iterates over one item.