title: Adding the Alias name from keytool to my working script
body: <p>I have the following working script however, I need to get the Alias name: and add this into my script, I have been down many rabbit holes and think I have confused myself and need some guidance.</p>
  <pre><code>#!/bin/sh
  
  until=$(keytool -list -v -keystore /usr/java/jdk1.8.0_301- 
  amd64/jre/lib/security/cacerts -storepass changeit | grep &quot;until:&quot; | 
  sed 's/^.*until: //')
  
  now_seconds=`date +%s`
  now_days=$((now_seconds / 86400))
  IFS=$'\n'
  
  for line in $until 
  do
      #if [ echo $line | grep -i alias ]
      #then cert_name=${$line}
      #else detail =
      certdate_secs=$(date +%s --date=&quot;$line&quot;)
      certdate_days=$((certdate_secs / 86400))
      expiry_date=$(($certdate_days - $now_days))
      if [[ $expiry_date -le 30 ]];
  then
      echo -e &quot;The Server hostng the cert is $HOSTNAME\n&quot;
      echo -e &quot;#############################################\n&quot;
      echo -e &quot;This is the keytool cert expiry in seconds: 
  $certdate_secs\n&quot;
      echo -e &quot;This is the keytool cert expiry in days: 
  $certdate_days\n&quot;
      echo -e &quot;#############################################\n&quot; #&gt; 
  $file
      echo -e &quot;The cert will expiry in $expiry_date days\n&quot; #&gt; $file
      echo -e &quot;********************************************\n&quot; #&gt; $file
  fi
  done
  </code></pre>