Sponsored Content
Full Discussion: remove temporary file ?
Top Forums Shell Programming and Scripting remove temporary file ? Post 302146904 by porter on Friday 23rd of November 2007 02:33:04 AM
Old 11-23-2007
If the file is truely a temporary file then delete it when your script finishes....

Code:
#!/bin/sh

cleanup()
{
    for d in $LAUNDRY_LIST
    do
        if test -f "$d"
        then
            rm "$d"
        fi
    done
}

trap cleanup 0

blah >my.tmp.$$

LAUNDRY_LIST="$LAUNDRY_LIST my.tmp.$$"

dostuff

do more stuff

 

10 More Discussions You Might Find Interesting

1. Ubuntu

Avoid creating temporary files on editing a file in Ubuntu

Hi, My ubuntu flavor always create temporary files having filename followed by ~ on editing. For eg: if I am editing a file called "sip.c", automatically a temporary (bkup) file is getting created with the name "sip.c~". How to avoid this file creation? (7 Replies)
Discussion started by: royalibrahim
7 Replies

2. AIX

error : pg: 0652-122 Cannot write to the temporary file

Hi All, I'm getting this error when I use "pg". /tmp is not full and the permission is correct. root@axappk01::/home> hostname|pg pg: 0652-122 Cannot write to the temporary file. Please advise. (6 Replies)
Discussion started by: fara_aris
6 Replies

3. UNIX for Dummies Questions & Answers

Ping temporary off and down

We have a sun server which when pinged temporarily responds and sometimes dont respond. Which problems may it is facing? (1 Reply)
Discussion started by: eelinker
1 Replies

4. Shell Programming and Scripting

Perl : how to modify a file without generate a temporary file

Hi All, I have a file like below, how can i insert one line after line 1 without using a temporary file in perl? line 1 line 2 line 3 expected result line 1 new line <---insert here line 2 line 3 (2 Replies)
Discussion started by: summer_cherry
2 Replies

5. Shell Programming and Scripting

temporary file to file then move to directory

Ok in my bash script i have 5 options to create a simple html script. I need to create a temporary file and whatever the user types will be stored in that file using html codes. And then I have another option in which that temporary file will be moved to the public_html directory in which the user... (19 Replies)
Discussion started by: gangsta
19 Replies

6. UNIX for Dummies Questions & Answers

mailx command - Temporary mail file: permission denied

Hi , I am facing a problem with respect to mailx command in unix . Earlier it was working fine and I am facing this issue only from last week . I used mailx command and I am getting a error message as follows : temporary mail file: Permission denied If I run mailx command from... (2 Replies)
Discussion started by: deepav1985
2 Replies

7. Shell Programming and Scripting

How to remove the first line of a file without using any temporary file

I want remove first line of the file without using any temporary file. Everything should be done in the original file itself since I don't any file creation access whereas I have modify access. It would be great if somebody help in this regard ASAP . Thanks in Advance. Kishore:mad: (1 Reply)
Discussion started by: tvbhkishore
1 Replies

8. Shell Programming and Scripting

How to remove a temporary file inside gawk

Hi- How can I make the temporary file 0 byte , created inside gawk. I am using system("rm -f temp_orders"); It seems system command is deleting file permanently and I am not able to execute below statement. print ORD_HEAD_FULL >> cFILE; (cFile is temp_orders) (2 Replies)
Discussion started by: ashish_kaithi
2 Replies

9. UNIX for Dummies Questions & Answers

Mailx - temporary mail message file: No such file or directory

How would I go about resolving this error temporary mail message file: No such file or directory Can anybody tell me where the default location is for the temporary mail message file is for mailx? It appears that it doesn't exist. Thanks (1 Reply)
Discussion started by: joen
1 Replies

10. Programming

Storing a Temporary File Using C

How would someone save a file such as /etc/vpnc/test.conf locally into a temp file, so it can be queried? So for example if I used rsync to copy this file locally, how would I add that to a temp_file variable and discard it using unlink? #include <stdio.h> #include "error.h" ... (15 Replies)
Discussion started by: metallica1973
15 Replies
pthread_cleanup_pop(3T) 												   pthread_cleanup_pop(3T)

NAME
pthread_cleanup_pop(), pthread_cleanup_push() - remove or register a cancellation cleanup handler SYNOPSIS
PARAMETERS
routine Routine registered as a cancellation cleanup handler. arg Parameter to be passed to the cancellation cleanup handler execute Indicates if the popped cancellation cleanup handler is to be executed. DESCRIPTION
installs the cancellation cleanup handler routine onto the calling thread's cancellation cleanup stack. This handler will be popped from the calling thread's cancellation cleanup stack and called with the arg parameter when any of the following occur: (a) the thread calls or returns from its start routine. (b) the thread acts upon a cancellation request. (c) the thread calls with a non-zero execute argument. When a thread terminates, it will execute each of the cancellation cleanup handlers on its cancellation cleanup stack. These handlers will be popped and executed in the reverse order that they were installed ( removes the cancellation cleanup handler at the top of the calling thread's cancellation stack. If execute is non-zero, the cancellation cleanup handler is called after it is removed from the cancellation stack. If execute is zero, the cancellation cleanup handler is simply removed and will not be called. and must appear as statements and in pairs within the same lexical scope. These functions may be macros which contain the opening '{' in the push function and the closing '}' in the pop function. Calling or is undefined if there have been any calls to or made without the matching call since the jump buffer was filled. Calling or from inside a cancellation cleanup handler results in undefined behavior unless the corresponding or was also done inside the cancellation cleanup handler. RETURN VALUE
The and functions must be used as statements. They do not have return values or errors. ERRORS
None. WARNINGS
The functions and must be called in the same lexical scope or the result is undefined behavior. AUTHOR
and were derived from the IEEE POSIX P1003.1c standard. SEE ALSO
pthread_cancel(3T), pthread_setcancelstate(3T). STANDARDS CONFORMANCE
Pthread Library pthread_cleanup_pop(3T)
All times are GMT -4. The time now is 10:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy