It is currently Tue, 17 May 2022 18:57:41 GMT



 
Author Message
 remove blank file
Hello Guru's

A blank file  with no name is created when I run some shell scripts.

Is there a way I can remove a blank file with no name, when I run a shell
script if it exists?

Thanks in Advance.

            J.
         ????
            ~



 Mon, 13 Oct 2003 00:54:38 GMT   
 remove blank file
news:9c6vec$2f5$1@bob.news.rcn.net...
There's no such thing as a file without a name.

Try using ls -lab to find what your file is called.



 Mon, 13 Oct 2003 02:44:38 GMT   
 remove blank file
Like I said there is no Filename and  the size is 0.

            J.
         ????
            ~
Phineas T. Barnham <PhineasTBarn...@PhineasTBarnham.com> wrote in message
news:988224608.24551.0.nnrp-07.9e985e86@news.demon.co.uk...



 Mon, 13 Oct 2003 02:59:47 GMT   
 remove blank file

news:9c76p0$1bl$1@bob.news.rcn.net...
Like I said there is no such thing as a file without a name.

If you can "ls" it, then it's got a name.

Maybe you can publish an extract from the shell script which is creating it.



 Mon, 13 Oct 2003 03:14:51 GMT   
 remove blank file
total 288
-rw-------   1 jj  Arsgrp         0 Apr 25 12:42
-rwx------   1 jj  Arsgrp      1244 Mar 29 12:54 const
-rw-------   1 jj  Arsgrp       109 Apr 25 15:29 fcmhlp
-rwx------   1 jj  Arsgrp      1930 Apr 25 12:19 menu
-rwx------   1 jj  Arsgrp       890 Apr 25 12:34 usrcmp

here is the output of ls -l  if you see the very first file is blank, and I
am not sure how does it create that file.....

--
            J.
         ????
            ~
Phineas T. Barnham <PhineasTBarn...@PhineasTBarnham.com> wrote in message
news:988226419.25581.0.nnrp-07.9e985e86@news.demon.co.uk...



 Mon, 13 Oct 2003 03:33:15 GMT   
 remove blank file
Hi Jack,

:) I assume your collection of shell script grab work without read/write
locking. No problem so far, it's exactly what tripwire does for example.
This is a mechanism to hide files temporarly. One process creates and
open it and goes sleeping and another one removes the file. The directory
entry for the file is gone and therefor the file is not visible to the
shell anymore but the file can still be accessed by the opening process.

Example
-------
In one terminal you do:
while :; do echo shit; sleep 1; done > /tmp/hidden_file

In another one you do:
rm -f /tmp/hidden_file

Now the first process still writes into the file but you can't see
it. Well actually under Linux you can f.e. do a
ls -l /proc/<PID_of_1_process>/fd/*

and you would see for example:

ls -l /proc/5490/fd/*
lrwx------   1 ratz     users          64 Apr 25 21:22 /proc/5490/fd/0 ->
/dev/pts/9
l-wx------   1 ratz     users          64 Apr 25 21:22 /proc/5490/fd/1 ->
/tmp/hidden_file (deleted)
lrwx------   1 ratz     users          64 Apr 25 21:22 /proc/5490/fd/10 ->
/dev/pts/9
lrwx------   1 ratz     users          64 Apr 25 21:22 /proc/5490/fd/2 ->
/dev/pts/9
lrwx------   1 ratz     users          64 Apr 25 21:22 /proc/5490/fd/255 ->
/dev/pts/9

The cure
--------
Kill the running process that acquires the file and by killing the process
the kernel will close the fd on this file. So no problem.

HTH,
Roberto Nibali, ratz

--
mailto: `echo NrOa...@tPacA.cMh | sed 's/[NOSPAM]//g'`



 Mon, 13 Oct 2003 03:33:44 GMT   
 remove blank file

news:9c78nn$9fh$1@bob.news.rcn.net...

Did you try the "ls -lab" ?

Post that output. If it still shows blank, then I'm off to the pub ;-)



 Mon, 13 Oct 2003 03:31:41 GMT   
 remove blank file
I had already used "ls -lab" and here is the output..
total 336
-rw-------   1 jj  Arsgrp         0 Apr 25 12:42
drwx--S---   2 jj  Arsgrp      1024 Apr 25 15:47 .
drwxr-sr-x  11 jj  Arsgrp      2560 Apr 25 14:29 ..
-rwx------   1 jj  Arsgrp      1244 Mar 29 12:54 const
-rw-------   1 jj  Arsgrp       109 Apr 25 15:33 fcmhlp
-rwx------   1 jj  Arsgrp      1930 Apr 25 12:19 menu
-rwx------   1 jj  Arsgrp       890 Apr 25 12:34 usrcmp

--
            J.
         ????
            ~
Phineas T. Barnham <PhineasTBarn...@PhineasTBarnham.com> wrote in message
news:988227429.26071.0.nnrp-07.9e985e86@news.demon.co.uk...



 Mon, 13 Oct 2003 04:07:18 GMT   
 remove blank file

"Roberto Nibali" <r...@tac.ch> wrote

This unlinking an open file which I do not think is the case here as the
file can apparently be seen using "ls -l".



 Mon, 13 Oct 2003 04:01:19 GMT   
 remove blank file
Infact I can remove the file manualy by using the command "rm -i *" but then
I only remove the first blank file and then hit control C.

--
            J.
         ????
            ~
Phineas T. Barnham <PhineasTBarn...@PhineasTBarnham.com> wrote in message
news:988227429.26071.0.nnrp-07.9e985e86@news.demon.co.uk...



 Mon, 13 Oct 2003 04:08:59 GMT   
 remove blank file

huh? What funny directory do you have here. Could you try to
remove it with \rm -i * and see if rm sees it? Could you also
post a \ls -bali, please?

And if you dare and if the scripts are not too big, could you
post them? I burn to see how one could achieve this. I've been
trying it but I fail somehow ...

Clueless so far and ready to go to the pub too,
Roberto Nibali, ratz

--
mailto: `echo NrOa...@tPacA.cMh | sed 's/[NOSPAM]//g'`



 Mon, 13 Oct 2003 04:12:24 GMT   
 remove blank file

Time problems ... by the time I sent my first reply this wasn't clear. But
I just see that I was at least right with rm -i *. Still wondering though
how you can create such a file with shell scripts :)

Cheers,
Roberto Nibali, ratz

--
mailto: `echo NrOa...@tPacA.cMh | sed 's/[NOSPAM]//g'`



 Mon, 13 Oct 2003 04:17:18 GMT   
 remove blank file
here's a quick stab at it - in the directory where it exists try this:
    find . -type f -ok rm {} \;

And when it gets to the file in question say 'y' to remove it.
Alternatively, try:
    file=`ls | head -n1`
    rm -i $file



 Mon, 13 Oct 2003 04:19:47 GMT   
 remove blank file

news:9c7ani$j40$1@bob.news.rcn.net...
Beats me.

Some unix systems let you do an octal dump of the directory.

od -c . <ENTER>

maybe that will show something.

I'm sure this should not be possible, a corrupt directory entry is a
possibility. Be interesting to see the shell that creates this.

I have seen (on SUN OS) where you can do an "ls -l" of a directory and see
the contents of a text file. That's event more bizarre.

The only solution there was to "rm -r" the directory.



 Mon, 13 Oct 2003 04:55:47 GMT   
 remove blank file
news:9c7aqo$jj7$1@bob.news.rcn.net...

If you don't know how the file is created then look for:
touch "$var " # var not set, thus creating a file named " " (space)
cat > <same or variant> #

Your file is the first listed, so do:
ls -1 | head -1 | od -c

eks:
root@chili#touch " "
root@chili#ls -1

ajf.ctrlm1
asdf
bas.txt
notes
su_script.exp
test.sh
root@chili#ls -1 | head -1 | od -c
0000000      \n
0000002
root@chili#ls -1 | tail -1 | od -c
0000000   t   e   s   t   .   s   h  \n
0000010

Now, identify your file in the same manner.

--
Stein Arne Storslett



 Mon, 13 Oct 2003 05:49:47 GMT   
 
   [ 25 post ]  Go to page: [1] [2]

Similar Threads

1. how to remove blank line in a file with vi

2. How to remove blank lines from within a file

3. Removing blank lines from a file.

4. remove all blank lines in text file

5. Remove blank lines from a file.

6. Removing groups of blank lines form a text file

7. remove a blank line in a file

8. Removing multiple blank lines from text files

9. How do I remove blank lines from files?


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software