bash script with optional arguments code example
Example 1: optional argument bash
VAR="${1:-default}"
Example 2: bash optional arguments
~$ sh co.sh
2017-01-05
~$ sh co.sh 2017-01-04
2017-01-04
~$ cat co.sh
DAY=${1:-$(date +%F -d "yesterday")}
echo $DAY