Reputation: 11
This is how my code goes. However I keep getting this error. I am not sure why. Could someone kindly help me?
syntax error near unexpected token `echo'
Upvotes: 0
Views: 519
Reputation: 530960
Whitespace is important here. {
is only special if it is a word by itself. What you have here is an attempt to define a function named localiser{
, but with the simple command echo ...
as the body. Function bodies must be compound commands (usually { ... }
).
Defining a function with the function
keyword isn't really recommended; it exists many for compatibility with ksh
. Use the following form instead:
localiser () {
...
}
Upvotes: 1