read value from file and compare, why syntax error?

Little Girl littlergirl at gmail.com
Mon Dec 14 01:43:46 UTC 2020


Hey there,

Bo Berglund wrote:

>I am baffled by this error being displayed when I run this script
>command which is meant to allow only one execution per day...

>I get the following error on the else line:
>
>./makeatjobs: line 8: syntax error near unexpected token `else'
>./makeatjobs: line 8: `else'
>
>Why is there a syntax error on the keyword else?????

The syntax error is actually on this line:

	if [ "$NEXTDAY" == "$LASTDAY" ] then;

All you need to do is move the semicolon into the correct position,
like this, so that Bash can find the "then" token that it needs:

	if [ "$NEXTDAY" == "$LASTDAY" ]; then

Your script should work smoothly once you do that.

-- 
Little Girl

There is no spoon.




More information about the ubuntu-users mailing list