bash-guide icon indicating copy to clipboard operation
bash-guide copied to clipboard

Function definitions: Add syntax that works for POSIX compliant shells

Open palash25 opened this issue 6 years ago • 0 comments

Ref: https://stackoverflow.com/questions/12468889/bash-script-error-function-not-found-why-would-this-appear

The syntax described in the guide should also be accompanied by this alternative so that beginners in bash don't face the error function not found like I did

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

say() {
    echo $1
}
say "hello world!"

Let me know if you need a PR for this I would be happy to do it :smile:

palash25 avatar Jan 26 '19 10:01 palash25