delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/27/09:51:28

Date: Fri, 27 Mar 1998 20:27:46 +0530 (IST)
From: "Mahadevan R." <mdevan AT md2 DOT vsnl DOT net DOT in>
Reply-To: mdevan AT iname DOT com
To: djgpp AT delorie DOT com
Subject: "bash"ing "cat"s.
Message-Id: <Pine.OSF.3.95.980327201633.15148A-100000@md2.vsnl.net.in>
Mime-Version: 1.0

Hi all.

     This is with reference to the recent thread about "cat -", wherein,
I gather, it was concluded that this was a problem specific to "cat".
But on my system..

C:\>bash
bash$ cat -
^Z
bash$ tac -
bash$ gawk --file=-
bash$ expand -
bash$ as
bash$

Now this is even funnier:

C:\>bash
bash$ cat -
^Z
bash$ wc
      0       0       0
bash$ wc
<waits for input, like it should>

I find that the above sequence can be generalized to:

C:\>bash
bash$ cat -
^Z
bash$ <any program that does not print anything when given an empty i/p
       file -- displays the funny behaviour>
bash$ <any program that prints anything at all on screen>
o/p of above pgm
bash$ cat
<waits for input, like it should>

Programs of the first category include addr2line (binutils), gasp
(binutils), gawk (gawk) and a horde of others, from various packages,
and hence I suppose bash is the culprit.

ls, "cat non_existing_file" etc. come under the second category.

And just to test that it is the printing-to-the-screen part that
nullifies the anomaly:

C:\>bash
bash$ cat -  # simply "cat" will do, BTW
^Z
bash$ any_program >/dev/null 2>&1
bash$ cat
bash$
<funny behaviour continues>

Finally, just one more thing:

C:\>bash
bash$ cat
^Z
bash$ cat  # funny behaviour starts..
bash$ cat <TAB><TAB>
autoexec.bat  config.sys  utils (completions displayed by bash)
bash$ cat  # cmd line redisplayed by bash, just hit enter
bash$ cat  # funny behaviour continues..
bash$

Comments ?

(Sorry about the new thread, this mail reader does not seem to know about
RFC934 (or whatever)). 

Happy bashing,
Mahesh (Mahadevan R.), <mdevan AT iname DOT com>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019