Reputation: 33
Say I have this function:
function run_sanity_check(){
echo -e "This is test level 1\n"
echo -e "This is test level 2\n"
}
and this other function:
function run_test(){
... environment setup routine runs here
echo -e "Running tests...\n"
run_sanity_check --> this would be my call for the function above
}
When I call "run_test" I get this error: function: not found
Any help is appreciated.
Upvotes: 1
Views: 15173
Reputation: 75545
As Brian's comment mentions, you need to use either function
or ()
but not both.
Both of the following are valid, based on the documentation.
function run_sanity_check{
echo -e "This is test level 1\n"
echo -e "This is test level 2\n"
}
run_sanity_check(){
echo -e "This is test level 1\n"
echo -e "This is test level 2\n"
}
The following script prints expected output.
run_sanity_check(){
echo -e "This is test level 1\n"
echo -e "This is test level 2\n"
}
run_test(){
echo -e "Running tests...\n"
run_sanity_check
}
run_test
Upvotes: 4