Problem when exporting bash functions

Hello,

We are encountering issues when exporting slightly complex bash functions with if then else conditions. Please see the example below:

  1. test1 .sh is a script that defines a function project_check, exports it and then invokes the script test2.sh via qsub

     bash-4.1$ cat test1.sh
      #!/bin/bash -norc
      function project_check() {
      status="DONE"
      if [ "$status" = "DONE" ]
      then
           echo "status completed"
      fi
     }
    

export -f project_check

qsub -l select=1:ncpus=1 -mn -o o.log -e e.log -joe -k oed -V – /home/padmaja/testwa/test2.sh

  1. test2.sh executes the function project_check

bash-4.1$ cat test2.sh
#!/bin/bash

project_check

When test1.sh is executed, it executes qsub and gives the below errors related to the export of the bash function:

bash-4.1$ /home/padmaja/testwa/test1.sh
8424.frmscd5

bash-4.1$ cat o.log
/bin/bash: project_check: line 0: syntax error near unexpected token ;' /bin/bash: project_check: line 0:project_check () { status=“DONE”; if [ “$status” = “DONE” ]; then; echo “status completed”; fi; }’
/bin/bash: error importing function definition for `BASH_FUNC_project_check’
/home/padmaja/testwa/test_script2.sh: line 3: project_check: command not found

If the function is changed to something simple as below, then it gets exported fine and everything works fine
function project_check() {
echo “hello world”
}

bash-4.1$ /home/padmaja/testwa/test1.sh
8426.frmscd5

bash-4.1$ cat o.log
hello world

Has anyone encountered a similar issue?

Thanks,
Padmaja