-2
#!/bin/bash
echo "1 - calendario"
echo "2 - data"
echo "opção: "
read var
if [$var -eq 1];
then
calendario=$(cal)
echo $calendario
elif [$var -eq 2];
then
now=$(date)
echo $now
else
echo "opção invalida"
fi
this is the output:
1 - calendario
2 - data
opção:
1
./calendar.sh: line 8: [1: command not found
./calendar.sh: line 12: [1: command not found
opção invalida
I want to give the user two options, one to print a calendar and the other to the current date, but without using "case", only with "if Else", I don’t know what I’m doing wrong
the last line of your code is
fi
really? anyway, try to structure/format the question better, it’s a bit confusing– rLinhares
I’ve tried to change it to make it better, but yes, it’s
fi
even– André Pires