How do I fix this? It just skips the if statement. I am trying to do an if statement that finds if the group entered meets the right criteria.
if $groupchosen== "student"; then
How do I fix this? It just skips the if statement. I am trying to do an if statement that finds if the group entered meets the right criteria.
if $groupchosen== "student"; then
The if
statement requires a command, not a bare comparison. Use test
(or its alias, [
).
if [ "$groupchosen" = 'student' ] then
I would suggest giving this a look. But long story short:
if [ "foo" = "foo" ]; then
echo expression evaluated as true
fi