Nohup causing issues

Hi folks... I really need some help soon with this issue I am having when I run my script using 'nohup'. Below is a function 'checkReturn' that my script uses to check whether other functions or tasks errored out with a non-zero exit code.

function checkReturn {
if [ $3 -ne 0 ]; then
echo "Error in step $STEP at line $2: Command return code: $3"
touch "$CMS_INBOUND_QUEUE/${1}_fail.sig"
exit $FAILURE
fi
}

Here is the error I get.... Note that when I run my script without the nohup, it runs fine.

function checkReturn {
./cms_inbBroker.sh: function: not found
+ [ -ne 0 ]
./cms_inbBroker.sh: test: argument expected

Thanks,

  • CB

Slightly more context about your script would be helpful. i.e. the context in which your script is run and in which the function is executed.

Running your script "nohup" doesn't mean nuch. So what! If you're running your script in the background and looking for a return code, you're clean out of luck.... it won't return one.

/cms_inbBroker.sh: function: not found

Looks like the script is not executed by ksh/bash. Put

!#/usr/bin/?sh

at the beginning of your script.