1
votes

Ok I know this has been posted a lot by bash newcomers but still, this is the program a teacher gave me, and it's not working properly.

#! /bin/bash
echo "month"
read month
case $month in
   january)
       echo "31" ;;
   february)
       echo "30" ;;
   *)
       echo "INVALID" ;;
esac
exit(0)

The terminal gives me two errors,

./shell2: line 15 : syntax error near unexpected token "0"

./shell2: line 15 : `exit(0)'

Could someone explain me one time for all? Thank you

1
Where's line #15? There are 12 in your code sample. - ceejayoz
hehe sorry, i forgot to add two lines, march) and echo "31" ;; - Greg Symsym
Don't mark a question "solved" by editing the title - rather accept the answer that solved it for you. See here: stackoverflow.com/help/someone-answers - Benjamin W.

1 Answers

6
votes

In bash parameters are not put in braces. It should be exit 0 instead of exit(0)