run commands within a script on certain days

Hi,

please advise a script, something like this:

If [day of the week is Tuesday or Thursday or Sunday];
then
do something
else ( or for any other day of the week )
do otherthing
fi

Thanks

_DATE="$(LC_ALL=C date +%A)"
if test "$_DATE" = "Tuesday" -o "$_DATE" = "Thursday" -o "$_DATE" = "Sunday"
then
  ...
else
  ...
fi

Thanks a lot, can you advise some tutorial, which can help me learn above script

try this..

-bash-3.2$ day=$(date +%A)
-bash-3.2$ if [ "$day" == "Tuesday" ] || [ "$day" == "Thursday" ] || [ "$day" == "Sunday" ];then
> echo "Today is $day"
> else
> echo "Exit"
> fi
Exit
-bash-3.2$

thanks this one is more easier for a newbie like me :slight_smile:

man test, or Tests