First time posting here. Be gentle.
I need some help with a bash script. I'm pretty new to bash and learning as I go. I'm beginning to suspect my problem has to do with how I'm writing to the temp file. Anyway, here's the script I'm trying to run:
#!/bin/bash
echo -e {PASSWORD} | sudo -S security_status.sh 2>/dev/null 1>./cert_tmp.log
Cert_Status=$(grep -i "Application" ./cert_tmp.log | cut -d" " -f3)
echo "Statistic.Status:$Cert_Status"
if grep -iq "start" ./cert_tmp.log; then
echo "Statistic.Refill_Date:Invalid"
exit 1
else
Cert_Refill=$(grep -i "start:" ./cert_tmp.log | cut -d"(" -f2 | cut -d ")" -f1)
echo "Statistic.Refill_Date:$Cert_Refill"
fi
if grep -iq "expiration" ./cert_tmp.log; then
echo "Statistic.Expire_Date:Invalid"
exit 1
else
Cert_Expire=$(grep -i "expiration:" ./cert_tmp.log | cut -d"(" -f2 | cut -d ")" -f1)
echo "Statistic.Expire_Date:$Cert_Expire"
fi
rm -rf ./cert_tmp.log
exit 0