I am looking to gzip multiple files (into multiple .gz files) in a directory while keeping the originals.
I can do individual files using these commands:
I'd use bash(1)'s simple for construct for this:
bash(1)
for
for f in *cache.html ; do gzip -c "$f" > "$f.gz" ; done
If I knew the filenames were 'sane', I'd leave off the "" around the arguments, because I'm lazy. And my filenames are usually sane. But scripts don't have that luxury.
""