![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| error : pg: 0652-122 Cannot write to the temporary file | fara_aris | AIX | 6 | 05-28-2008 10:42 PM |
| Disposable Temporary E-mail 1.4.0 (Default branch) | iBot | Software Releases - RSS News | 0 | 04-13-2008 01:30 AM |
| Avoid creating temporary files on editing a file in Ubuntu | royalibrahim | Ubuntu | 7 | 11-17-2007 05:57 AM |
| Removing temporary alias | veccinho | AIX | 1 | 09-04-2007 05:19 AM |
| solve temporary root password | go3mon | Shell Programming and Scripting | 1 | 06-23-2005 08:09 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi all,
In the script I am creating a temporary file with process id as temp.txt.$$ I want to remove this tomporary file first from the current directory when i'll run the same script next time. Note: Every time when the script executes then it has unique process id and it'll create a unique temporary file. $$ shows the process id. How to do that please let me know. Thnks in advance. ![]() |
|
||||
|
Quote:
Hi, rm temp.txt.* This will remove the temporary file. Regards, Chella |
|
||||
|
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
|
|
||||
|
Thanks buddy...
Can i put this in Conditional statement ? As i used following : if [ -f tempdspmq.txt.* ] then rm tempdspmq.txt.* ; fi But its not working...Please let me know, any solution to this. ![]() Thnks porter, I have checked your script too. Thnks !! ![]() |
|
||||
|
Quote:
I liked this Optimized approach !! Thanks ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|