🌱 Last Day Bash Script
#!/bin/bash
day='Wed'
today=`date "+%a"`
if [ "$today" == "$day" ]
then
VAR=$(date -v-7d "+%Y-%m-%d")
else
VAR=$(date -v-"$day" "+%Y-%m-%d")
fi
echo -n $VAR
#!/bin/bash
day='Wed'
today=`date "+%a"`
if [ "$today" == "$day" ]
then
VAR=$(date -v-7d "+%Y-%m-%d")
else
VAR=$(date -v-"$day" "+%Y-%m-%d")
fi
echo -n $VAR