K shell /tmp/sh$$.* files problem

Hi,
I am encountring this problem from some time now...
ksh creates temp files /tmp/sh$$.* .
Sometimes if some of my shell script crashes or I kill it... these temp
files remain in the /tmp directory.
At some later time when some script gets the same PID it tries to
create files in the /tmp directory, It fails complaining that

sh$$.* : cannot create

Its a multi user unix system... so shell script may not overwrite files
created by other user.

Does any one have a solution to this problem....?

I dun want to do something like checking and deleting stray temp files
once in a while...

May be each user can have a separate TEMP directory...

Thanks

Why don't you use the username as part of the name of the tempfile that is created? You can use $USER or $LOGNAME, whatever your system sets when the user logs in.
i.e.
instead of /tmp/sh$$., use /tmp/$USER.sh$$. or /tmp/$LOGNAME.sh$$.*. This will create a file that can only be overwritten by that user as usernames are unique.

I am not creating these files.... the shell creates them... Ho can I force there name??

To my knowledge, ksh does not create any temp files on its own. You may have some customized feature that is doing this. The best thing would be to find the source of these files and change the program that is creating them.
As a workaround, maybe you can schedule some sort of cron job that will remove the files from the /tmp filesystem every few minutes.

ksh does indeed create temp of its own. They always go into /tmp and have names like sh$$.1. We have a few such files laying around. I have never seen a script fail like though. I kinda assumed that if sh$$.1 didn't work that the shell would go on to sh$$.2 and so on. But I'm not sure of that. I rarely do a "kill -9". I'm sure that I would see lots of sh$$.1 files laying around if I did "kill -9" more often. The OP rejected the solution I would use, so I have no remedy to suggest.

Shell creates a temporary file whenever it encounters a " << " . in the /tmp folder... If the file already exits in the location..and shell fails to overwrite (permissions) the sript fails....

As I told earlier I dun want a cron job to delete these files....

Is there any way I can change the path of creation for these tmp files... ?