If you use a , your .logout file can clean up the temporary files. The exact cleanup command you'll use depends on how you create the files, of course. The overall setup looks something like this in .logout:
(set nonomatch; cd ~/temp && rm -f *) &
The parentheses run the commands in a
so the cd command
won't change the current shell's working directory.
The C shell needs a
command so the shell will be quiet if there
temp files to clean up;
omit that command in Bourne-type shells.
rm won't run unless the
cd ~/temp first, instead of just
keep rm's command-line arguments from
if there are lots of temporary files to remove.
If you could be logged in more than once, be careful not to remove
files that other login sessions might still be using.
One way to do this is with the
command - only remove files that
haven't been modified in the last day:
find ~/temp -type f -mtime +1 | xargs rm -f &