I have some problems when trying to run an interactive sh session inside a shell script. The inner sh process uses all the CPU and never terminates.
To reproduce the issue simply create a file named "script.sh" containing something like this:
sleep 10 | sh -i | sleep 10 &
and execute it using:
sh script.sh
sleep commands are just placeholders, I have other commands piping input into sh -i and processing its output. I know this is a very odd setup but it would be better if I could use an interactive shell and, at this point, I'm very curious and I want to understand what's happening.