The objective is to use bash shell to count days since a specific date until now ( today ).
# - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user
The easiest way to perform days count since a specifics day is to first get a number of seconds since epoch time ( 1970-01-01 ) for both dates. As an example lets count number of days since 28.12.1999 until today 8.1.2018. Consider a following example:
$ echo $((($(date +%s)-$(date +%s --date "1999-12-28"))/(3600*24))) days
Let's add little bit of readability to the above command by using variables. First, we get seconds since epoch time ( 1970-01-01 ) until now: