The service for a piece of software I just installed (from a provided .deb file) on a Ubuntu server won't start. When running the service I get the error:/etc/init.d/matrixsa: 44: Syntax error: } unexpected (expecting fi)Here is the relevant part of the script. Not being versed in shell scripting I don't know if this is valid:if [ -f /etc/rc.d/init.d/functions ]then    . /etc/rc.d/init.d/functionselse    function action {        echo $1        shift        $@    } # <-- this is line 44    function success {        echo -n Success    }    function failure {        echo -n Failed    }fi
Help me debug Syntax error: } unexpected (expecting fi)
shell script;services
$@ could contain anything, even things which make your function suddenly syntactically invalid. Quote it instead. Here is a less breakable version of the script:if [ -f /etc/rc.d/init.d/functions ]; then    . /etc/rc.d/init.d/functionselse    action() {        printf '%s\n' $1        shift        $@    }    success() { printf Success ; }    failure() { printf Failed ; }fiIf you are using bash or similar, you could use the following as the action function:action() {    printf '%s\n' $1    ${@:2}}If it is important that it splits on IFS like the original script (it probably isn't), unquote $@.It's also possible that you're running this in a non-bash shell. function is a bashism, use func() instead.