I want to write a shell script to check if the first param is empty or contains the string "task". I tried:
if [ -z "$*" ] || [$1 != *"task"*] ; then
echo "Empty or not contains task"
else
echo "Contains task"
But it is not correct. I even tried to break down the condition:
if [ -z "$*" ] ; then
echo "empty"
elif [$1 != *"task"*] ; then
echo "Not contains task"
else
echo "Contains task"
The empty condition is correct but the condition check on contains string not correct. Anyone knows how to fix it?
Thanks