I work for a webhost as a front level tech and often we need to install a SSL for a customer. I'm on a Mac now but am familiar with Linux as well.
What I'm looking to do would be to take the zipped file, download it to my mac and then run the command to both unzip it and cat at one pop. Thus eliminating the tedious process of unzip file.zip and then copy each file, one at a time to run cat.
I'm lame when it comes to writing a script and have played around with multiple commands, none that worked out.
Best Answer
So I've done some testing, and it seems that
gzcat
(and eventzcat
) on OS X only work for gzipped files, and not files using standard zip compression. That being said, I believe this is what you are looking for:"sub.domain.tld.ssl.zip" contains 2 files:
In order to print all files to
STDOUT
, you would useunzip -p
To "
cat
" the certificate, you could use the following command:To "
cat
" the private key, you could use the following command:Afterwards, of which you could do what you wish, such as create a little script or function:
The above script would take 2 arguments (which should ideally be enclosed in quotes):
If the name of the script was
sslinstazip.sh
, you would run it like so:There are obviously many ways you can modify this to fit your own personal needs, but in this case,
unzip
is actually your friend.