home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!casbah.acns.nwu.edu!navarra
- From: navarra@casbah.acns.nwu.edu (John Navarra)
- Subject: Re: cat a > a , getting it straight
- Message-ID: <1992Dec17.074018.3226@news.acns.nwu.edu>
- Sender: usenet@news.acns.nwu.edu (Usenet on news.acns)
- Nntp-Posting-Host: unseen1.acns.nwu.edu
- Organization: Northwestern University, Evanston Illinois.
- References: <1992Dec17.020805.28043@news.acns.nwu.edu> <1gp7lsINNlok@early-bird.think.com>
- Date: Thu, 17 Dec 1992 07:40:18 GMT
- Lines: 47
-
- In article <1gp7lsINNlok@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
- >In article <1992Dec17.020805.28043@news.acns.nwu.edu> navarra@casbah.acns.nwu.edu (John Navarra) writes:
- >>Why does appending a to a with cat not work but wc a >> a does produce
- >>the output from wc that is expected?
- >
- >Because cat checks whether the input and output are the same file. When
- >this is so, it prints the warning message and exits. Wc (and most other
- >programs) doesn't check, so the expected thing happens.
-
- Ok, this, I expected. After discussing this with Leif Jensen though, I found
- some more interesting stuff which we can't explain. Check this out:
-
- [casbah:67] ~/tmp -> uname -a
- unOS casbah.ac 4.1.2_DB 14 sun4m
- [casbah:68] ~/tmp -> cat a | cat > a
- [casbah:69] ~/tmp -> cat a
- file a
- [casbah:70] ~/tmp -> cat a | cat > a
- [casbah:71] ~/tmp -> cat a
-
- [riemann:59] ~/tmp -> unset noclobber
- [riemann:60] ~/tmp -> uname -a
- SunOS riemann 4.1.1-IP 2 sun4c
- [riemann:61] ~/tmp -> cat a
- file a
- [riemann:62] ~/tmp -> cat a | cat > a
- [riemann:63] ~/tmp -> cat a
- file a
-
- But, this output is not predictable. Sometimes, a was clobbered several
- times in a row. Sometimes, a was preserved several times in a row. Once,
- I even got this:
-
- [casbah:58] ~/tmp -> cat a | cat > a
- cat: write error: Bad address
-
- Somebody is not doing their job right. I couldn't reproduce this on non-Sun
- machines though.
-
- -tms
-
-
- --
- You can get further with a kind word | You can get further with a kind word
- and a gun than a kind word alone. | and a phaser than a kind word and a gun.
- --al capone | -- John Navarra
- =======From the Lab of the MaD ScIenTIst....navarra@casbah.acns.nwu.edu========
-