For a starter I know the braces are NOT in the code...
Consider these code snippets:-
Now using OSX 10.7.5 and bash here is the result:-
Why do the first two snippets work as predicted, (although without the braces), yet the third crashes out with the error report?
What is going on?
Can someone explain what is going on?
Many thanks...
According to the standards, the body of a function definition is a compound command. The most common compound command used when defining a function is a brace group, such as:
but other compound commands include if statements, subshells, for loops, case statements, while loops, and until loops. The echo command by itself is not a compound command.
These 5 Users Gave Thanks to Don Cragun For This Post: