Open driespieters opened 4 years ago
@driespieters I'm switching to ZSH and having this same issue. I don't know ZSH script, but messed around a bit and it looks as though the comments in Shopify's sample ssl-check script were what was causing the issue. The following code ā stripped of comments ā is working for me.
function ssl-check() {
f=~/.localhost_ssl;
ssl_crt=$f/server.crt
ssl_key=$f/server.key
b=$(tput bold)
c=$(tput sgr0)
local_ip=$(ipconfig getifaddr $(route get default | grep interface | awk '{print $2}'))
domains=(
"localhost"
"$local_ip"
)
if [[ ! -f $ssl_crt ]]; then
echo -e "\nš ${b}Couldn't find a Slate SSL certificate:${c}"
make_key=true
elif [[ ! $(openssl x509 -noout -text -in $ssl_crt | grep $local_ip) ]]; then
echo -e "\nš ${b}Your IP Address has changed:${c}"
make_key=true
else
echo -e "\nā
${b}Your IP address is still the same.${c}"
fi
if [[ $make_key == true ]]; then
echo -e "Generating a new Slate SSL certificate...\n"
count=$(( ${#domains[@]} - 1))
mkcert ${domains[@]}
test ! -d $f && mkdir $f
if [[ $count = 0 ]]; then
mv ./localhost.pem $ssl_crt
mv ./localhost-key.pem $ssl_key
else
mv ./localhost+$count.pem $ssl_crt
mv ./localhost+$count-key.pem $ssl_key
fi
fi
}
The Bash function to create a self signed SSL certificate won't work after switching to ZSH. (Default now on OSX)
https://github.com/Shopify/slate/wiki/4.-Create-a-self-signed-SSL-certificate
Does anyone know how to modify the script to run in ZSH?
Temporary fix: revert the console shell to Bash.
chsh -s /bin/bash
(Also restart terminal)