How can I return to my bash prompt automatically after printing output from a function that was put in the background?
For example, when I run the following script i
What is the problem you're trying to solve?
Right now, this is more or less a cosmetic problem. You're still in the shell, and the prompt is still there. Just type another command and it will be executed.
Alternatively, run the function in the foreground, or if you need to do something else in between, use wait:
$ fn & pid=$!
$ : something else
$ wait ${pid}