I'm pretty new to bash and and stumbling at this issue.
I have an input file that shows my gpg keys and their expiration dates. I'm using a while-read loop to attempt to read the file and parse out the two fields I need...
#!/bin/bash
input="/home/currentkeys.txt"
checkdate=`date -d "+30 days" +%s`
while IFS= read -r line
do
keydate=`awk '{print $4}'`
printf "%s\n" $keydate
keyuid=`awk '{print $1}'`
printf "%s\n" $keyuid
done <"$input"
But when I run the script, it's only printing the $keydates to screen...
bash-4.2$ ./keyexpiryreport.sh
2020-08-08
2022-09-10
2022-09-10
2022-09-17
...
eventually I'm going to use $checkdate to compare against the $keydate to see if we're getting close to the key expiring, but if I can't get the second variable to work I'm kinda stuck here...