17.11.2024 20:25, Andreas Kähäri пишет:
> A the final right curly brace of a compound command must be preceeded by
> a command terminator
Not always:
$ f() {} ; typeset -f f
f() {}
> most commonly a newline or a semi-colon. This is
> what causes the syntax error in the script.
No, that would be a different error:
$ sh -c 'f() { f }'
sh: syntax error: `{' unmatched
> An additional issue is that your login function would call itself,
> causing an infinite recursion. To prevent this, call "login" as
> "command login" in the function body.
Yes, but that is out of scope/not the point here.