bash command to make argument optional 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