I have a while loop to count to 5 and echo Done when finished. I want to be able to execute the script in the background with & and continuing issuing commands while it runs. But when it's done, I want it make itself the foreground process before echoing Done. After that, I would expect it to show a new command prompt line. I can just echo \nDone, and I understand why running it in the background would just print the output and not end/start a new prompt. But I'm wondering if it's possible to basically kind of merge jobs back together before ending, and if I could apply that elsewhere, with built-in job control in my scripts.This is not a practical problem, just curious.    i=0    while [ $i -lt 5 ]    do        let i+=1        sleep 1    done    fg    echo Done
Can a process bring itself back to the foreground on completion? (AIX/ksh)
shell;ksh;aix
Nope - Running processes can't do that sort of thing, because they're backgrounded by the shell and its the shell's job to say which process is foregrounded / backgrounded / suspended.Try this - Remove the fg, and then run your shell script backgrounded (ie with a & on the end)  When its finished, the output will be blurted to your console.