Next Business Day after 15th Bash Script

2019-09-21 21:02发布

问题:

I need bash script for next business day after 15th of the current month. It should only give me next business day after 15th. I'm totally new to Bash Script. Thanks a lot. d=1 while (($(date -d "$d days" +%u) >= 6)); do ((++d)); done date -d "$d days" +%m/%d/%Y

回答1:

Quick and dirty using cal: First case is Friday, then Saturday, then Sunday.

( cal | grep -q "15 16$"  && echo 18  ) || ( cal | grep -q "15$"  && echo 17  ) || (  echo 16 )


标签: shell