Clean temp file create and cleanup


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. tf=/tmp/tf.$$
  2. cleanup() {
  3. rm -f $tf
  4. echo $tf "removed."
  5. }
  6. trap "cleanup" EXIT
  7.  
  8. touch $tf
  9. echo "$tf created"
  10. #temp file auto removed on exit or on quit

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.