Removing shell temp files
john.urban
urban at cbnewsl.att.com
Tue Apr 23 06:45:55 AEST 1991
In article <T38s11w164w at ersys.uucp> ersys!dpulyk at nro.cs.athabascau.ca (Dennis Pulyk) writes:
>Is there a way to get the shell (bourne) to remove temporary files that
>it creates from 'here is' documents? . We use shell scripts that use the
>form cat <<! ... and if the shell gets killed off (ie from autologoff
>routines, etc) files of the form /tmp/shxxxx are left floating around.
>Other then periodically cleaning up /tmp, is there a better way to get
>the shell to clean up its act??
>Much thanx for any help.
>
>Dennis Pulyk ersys!dpulyk at nro.cs.athabascau.ca
>Edmonton Remote Systems: Serving Northern Alberta since 1982
This is an old bug in the bourne shell which has been fixed in the lastest
releases.
For example, the bourne shell on UNIX System V/386 Release 3.2 Version 2.2
does not have this problem.
In the short term, you could add this little front end to your here shell scripts ...
sh <<!
ls -l /tmp
rm -rf /tmp/sh$$*
ls -l /tmp
exit
!
As you see your /tmp/shxxxx file is gone.
However, for your cat <<!, this won't work.
Sincerely,
John Urban
More information about the Comp.unix.questions
mailing list