Bash script error: “function: not found”. Why would this appear?

前端 未结 4 1127
轮回少年
轮回少年 2020-12-08 00:09

I\'m trying to run a bash script on my Ubuntu machine and it is giving me an error:

function not found

To test, I

4条回答
  •  醉酒成梦
    2020-12-08 00:27

    I faced the same problem, I then modified the syntax and it worked for me. Try to remove the keyword function and add brackets () after the function name.

    #!/bin/bash
    
    sayIt()
    {   
       echo "hello world"
    }
    
    sayIt
    

提交回复
热议问题