Source part:
if [ $(jq -r '.patch_at' update.json) -ge "4" ]; then
recentlycheckedat=$(echo '('`date +"%s.%N"` ' * 1000000)/1' | bc)
contents="$(jq '.recently_checked_at = "$recentlycheckedat"' update.json)" && \
echo "${contents}" > update.json # have to fix, its literally writing $recentlycheckedat
fi
Focus:
contents="$(jq '.recently_checked_at = "$recentlycheckedat"' update.json)"
How to insert the content of the variable "recentlycheckedat" instead of literally printing out "$recentlycheckedat"?
It stores the current timestamp as a command on a variable, but this variable can't work inserted in a command inside another variable. How to achieve this? And feel free to edit with an more appropriate title.
full source - https://github.com/DaniellMesquita/Web3Updater
Update - solution:
".recently_checked_at = "$recentlycheckedat"" (many thanks to @ilkkachu)