Signals in a shell script become very complex very fast. Notice that the OP complained about using:
trap "`echo "Ctrl-Z key disabled"`" 20
Using the correct quoting is not any better:
trap "echo Cntl-Z key disabled" 20
You guys are proposing:
trap "" 20
which works fine. Whole different stretch of road. Try your scripts using the above trap statement. When you get tried of waiting for them, open another window, locate that sleep process, and do a "kill -CONT" to it.
Control Z is usually the SUSP character. Typing the SUSP characters sends SIGTSTP to all processes in the terminal's foreground process group. To disable control Z, the command is:
stty susp ^-
All of the posts here deal with catching or ignoring the TSTP signal, not disabling Control Z. Remember that shell scripts are collections of processes. The shell uses fork() and exec () to run the sleep program. From the exec man page:
Quote:
The processing of signals by the process is unchanged by exec*(), except that signals caught by the process are set to their default values (see signal(2)).
So when TSTP is ignored, it stays ignored during the execution of the sleep process. But if it was caugth, it goes back to the default action which is to suspend the process. This is bad enough, but what's more, ksh has some bug involving caught job control signals. ksh has it own internal routine to catch those signals. It gets run instead of the specified command. So you don't even get the the message echoed.
I can only curse the darkness. I don't have a candle to light. Sorry.