I am trying to set up a menu system where on selection it runs a function. In my case is runs the 'testfunc' function. However is it fails giving the error; testfunc: command not found.
My case statement looks like this;
case "$mainMenuInput" in
1)testfunc ;;
esac
function testfunc{
echo "This is a test"
}
Thanks in advance.
Shell scripts are executed statement at a time. The function is only known from the point you define it. You have to move it before the call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With