1

I'm new to shell scripting and am trying to run a simple script with a function in it. I keep getting an error message relating to my use of echo. Can anybody tell me how to fix this error?

Here's the code:

function functionA{ echo "FunctionA is executing!!" } functionA 

Here is the error message on the command line:

function1: line 4: syntax error near unexpected token `echo' function1: line 4: ` echo "FunctionA is executing!!"' 

1 Answer 1

1

You need () after function names:

function functionA() { echo "FunctionA is executing!!" } 
Sign up to request clarification or add additional context in comments.

1 Comment

Assuming the function keyword is supported, the parentheses should be optional. More likely, the space before the opening { is the solution.