Hi,

Simpler again ;)
 - no sed, no tr, no /dev/null redirection


#!/bin/bash

SECRET=my_base32_secret
SERVER_URL=http://google.com

while :
do
        NOW=$(curl -Is $SERVER_URL|grep ^Date:\ )

        # strip first 6 characters (Date: ) & the new line (\n)
        NOW=${NOW:6:-1}
        echo "$NOW -- $(date) -- $( \
                /usr/bin/oathtool --totp -b -d 6 \
                        --now="$NOW" $SECRET \
        )"
        sleep 1
done


Cheers
A.

Reply via email to