Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jul 1995 14:42:54 -0700 (PDT)
From:      John-Mark Gurney <gurney_j@efn.org>
To:        Ade Barkah <mbarkah@hemi.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Being curious with `cat * > file'
Message-ID:  <Pine.NEB.3.91.950719143152.3461C-100000@unix.nike.efn.org>
In-Reply-To: <199507192022.OAA10037@hemi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 19 Jul 1995, Ade Barkah wrote:

> Hello,
> 
> What should `cat * > output` do ? Should it gracefully concatenate
> all the files together into a file called `output', or will it
> attempt to cat the output into itself so many times until the
> file system is filled ?
> 
> In FreeBSD 2.0.5-950622-SNAP, the results are somewhat random:
> sometimes graceful, other times it fills up the file system.
> Is this a bug, feature, or is doing `cat * > output` considered
> an error ?
> 
> The "problem" appears on two 2.0.5 machines here.

well... I just did a little research... and if you susspend a session.. 
and take a look at the ps -ax you will set that it is converted to "cat 
output testfile output2"... and through futher research... this only 
appears in csh and tcsh... I tried this on zsh, ksh, bash, and sh... so I 
would have to say it is a bug in the shell... 

to further test is I telneted over to my ISP running SunOS...  and tested 
it there...  it would geneterate a error "cat: input ouput is output"... 
sounds like cat needs to detect where it is being redirected and if to a 
file make sure that the file isn't a file that is being catted...  

so overall... there is possibly two bugs...  a) tcsh and csh add the 
output file to the command line because it first creates the null file to 
add the output file then resolves the wildcard command line...  this last 
part is only a guess... I haven't actually checked up on it...  b) by 
SunOS's version our cat is a little brain dead in that is doesn't detect 
this type of problem... but in someways it is nice to have a brain dead 
cat... can't think of any... but there might...

[...]


John-Mark

gurney_j@efn.org
Modem/FAX: (503) 683-6954   (FreeBSD Box)

Live in Peace, destroy Micro$oft, support free software, run FreeBSD (unix)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.91.950719143152.3461C-100000>