It is annoying to me that return 0 only works when a file is sourced and when doing a sub-shell you need to exit 0. I'm trying to create a function whose code will be evaluated in the parent scope so that it can do:
return 0 2>/dev/null exit 0 This is the simplest solution in the parent's scope because if return fails then exit will work & it covers all cases. But it only works of course when coded in the parent scope because a return inside a function scope will obviously return from just the function.
How is it possible to do this? I prefer simplicity, but it may not be possible for this problem