I've been writing a script with #!/bin/bash shebang for a school project but I found out few hours ago that the shebang has to be #!/bin/sh. Could you advise me how to format the second if-condition so it would be compatible for every shell script?
if [[ -z $date ]]; then
echo "No date argument"
exit 1
elif [[ $date =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
return
if [ -z "$date" ]: if$dateis really empty, without double quotes it will fail. And there is no need of double brackets in this comparison.