I can see that my test_sigterm.sh is getting killed on receiving the "SIGTERM" in either case, when run in background (&) and foreground. But the ksh man pages say - Signals. The INT and QUIT signals for an invoked command are ignored if the command is followed by & and the monitor option is not active. Otherwise, signals have the values inherited by the shell from its parent (but see also the trap built-in command below).
Is it a know or default behaviour of ksh to NOT IGNORE SIGTERM? or is an issue with ksh child SIGTERM signal handling?
I find nothing unusual in the behavior you describe; only an interactive shell should ignore SIGTERM. As kill's default signal, SIGTERM wouldn't be very useful if it were widely ignored.
The SIGTERM signal isnt being caught as it isnt SIGINT or SIGQUIT as the manpage says. If monitor option is off "set +o monitor" then sending a "kill -INT <pid>" or "kill -QUIT <pid>" wont terminate your job but not if you send a "kill -TERM <pid>" to it...
As alister already said, the default signal handling behavior for SIGTERM is to terminate the process. Since you haven't ignored SIGTERM in your current shell and you don't ignore SIGTERM in test_sigterm.sh, test_sigterm.sh should terminate the process and that is exactly what you're describing. If you need test_sigterm.sh to ignore SIGTERM signals, change test_sigterm.sh from:
#!/bin/ksh
trap 'echo "removing"' QUIT
while read line
do
sleep 20
done
to:
#!/bin/ksh
trap '' TERM
trap 'echo removing' QUIT
while read line
do
sleep 20
done
Note that in addition to adding a trap to ignore SIGTERM, I:
moved the #!/bin/ksh to the start of the line (with it where it was, the default shell for your system will be used to run this script instead of the Korn shell),
removed the double quotes around removing (there is no need to quote a single word operand to the echo utility), and
indented the body of the while loop (to make it easier to see the structure of your shell script).