Issue
I'm working on a bash script that checks if a backup has been made in the last X days. The script must be run on linux and macos. My problem is, that when it checks if it's running on a linux or macos system, I don't understand what the '@' means before the 'bckpT' variable on linux part.
case "$OS" in
DARWIN)
lastBackup=$($DATE -u -r $bckpT +%F)
;;
LINUX)
lastBackup=$($DATE -d @$bckpT +%F)
;;
WIN)
$ECHO "No script for WIN"
;;
*)
help
;;
esac
When there isn't the '@', the output is:
/usr/bin/date: invalid date '1647907200'
Solution
In date
command the @
sign tells the command to treat the following as seconds since epoch
In your case, it consider the param $bckpT
value as seconds since epoch
Answered By - Saar Levy Answer Checked By - Marie Seifert (WPSolving Admin)