I want to create some variables that would return the date for previous days
And then use those in variables in other text replacement macros
e.g.
Last Wednesday = %xdlw%
Last Thursday = %xdlth%
Is the best way to do this to create shell scripts, that save results to variables, for each day and trigger those every 24 hours?
e.g. - Last Wednesday
#!/bin/bash
day='Wed'
today=`date "+%a"`
if [ "$today" == "$day" ]
then
VAR=$(date -v-7d "+%m/%d/%Y")
else
VAR=$(date -v-"$day" "+%m/%d/%Y")
fi
echo -n $VAR