So perhaps we need to clarify what you mean by "batch process".
Consider the following script and output:
Code:
$ cat hello_world
#!/bin/bash
echo Hello World
return 0
$./hello_world
Hello World
./hello_world: line 4: return: can only `return' from a function or sourced script
$ echo $?
1
but if we change the interpreter to
#!/bin/sh
Code:
$ cat hello_world
#!/bin/sh
echo Hello World
return 0
$ ./hello_world
Hello World
$ echo $?
0
We see that sh allows return to be the same as exit at the end of the main code line. Now let's run it in the way I think you mean by "batch":
Code:
$ bash ./hello_world
Hello World
./hello_world: line 4: return: can only `return' from a function or sourced script
$ echo $?
1
$ sh ./hello_world
Hello World
$ echo $?
0
Same thing. The final form of executing the shell scripting code is via the
. (dot) source command:
Code:
$ . ./hello_world
Hello World
$ echo $?
0
Now, change the return to an exit, and try each of the above tests. I'll leave that to you to test out. But this will be the thing that makes your choice clear, so be sure to actually perform the three execution variants. And then the man page segment shows:
.
Code:
return [n]
Causes a function to exit with the return value specified by n.
If n is omitted, the return status is that of the last command
executed in the function body. If used outside a function, but
during execution of a script by the . (source) command, it
causes the shell to stop executing that script and return either
n or the exit status of the last command executed within the
script as the exit status of the script. If used outside a
function and not during execution of a script by ., the return
status is false. Any command associated with the RETURN trap is
executed before execution resumes after the function or script.