Why my shell script doesn't delete a file ??

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2005
Posts: 2
Reputation: garlam is an unknown quantity at this point 
Solved Threads: 0
garlam garlam is offline Offline
Newbie Poster

Why my shell script doesn't delete a file ??

 
0
  #1
Jan 28th, 2005
I wrote this shell script:

#!/bin/sh

PATH=/sbin:/usr/bin:/usr/sbin; export PATH

echo "Content-type: text/html"
echo ""

ROOT=/app/webchecker/controller
FILEIN=$ROOT/log/servcheckerstat.txt
FILEDOWN=$ROOT/bin/down_
FILEOUT=/tmp/wcHtmlStat.$$
$ROOT/bin/servckhtmlstat W $FILEIN $FILEDOWN $FILEOUT $QUERY_STRING
cat $FILEOUT
rm -f $FILEOUT
exit 0

servckhtmlstat is a C program which do all the job and write the file.

The problem is:

the shell script doesn't remove the temporary file .... why ????

P.S

I call the script from an html page.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Why my shell script doesn't delete a file ??

 
0
  #2
Jan 28th, 2005
the html page is probably being run as "nobody" or another user of the sort. do an ls -l on the file you are trying to remove, and check the permissions, and the ownership of the file. If the permissions are not set correctly.... it won't remove the file.
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 2
Reputation: garlam is an unknown quantity at this point 
Solved Threads: 0
garlam garlam is offline Offline
Newbie Poster

Re: Why my shell script doesn't delete a file ??

 
0
  #3
Jan 28th, 2005
Originally Posted by Comatose
the html page is probably being run as "nobody" or another user of the sort. do an ls -l on the file you are trying to remove, and check the permissions, and the ownership of the file. If the permissions are not set correctly.... it won't remove the file.
The user is the same as the file owner.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Why my shell script doesn't delete a file ??

 
0
  #4
Jan 28th, 2005
Ok, And The permissions are set correctly (700, or 755 or something like that) so that the owner has permissions to delete?

Also, This seems silly that it would have any effect, but try making the shell script remove the file WITHOUT using the variable.... try it with a literal and see if it removes the file. If it does, then it's something with the variable, if it doesn't.... well, it's something else.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



Tag cloud for Shell Scripting
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC