bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27136: info coreutils


From: Pádraig Brady
Subject: bug#27136: info coreutils
Date: Mon, 29 May 2017 15:08:27 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 29/05/17 14:06, kalle wrote:
> hello,
> I think it is not obvious for everyone how to deal with Standard Input in the 
> `cat'-command. I took some time to figure out, that Ctrl-d  aborts it. and 
> just now I realized, that EOF the first time acts to terminate a so called 
> "record" (I got the term from "info coreutils 'tac'"), and applied twice 
> terminates the Standard Input. If <newline> was typed before it is enough to 
> type it once.
> So I think it would be helpful for some people if in the documentations 
> man/info cat there would be at least a reference, if not a short explanation 
> how to deal with Standard Input.

Note this is nothing specific to cat or coreutils for that matter.
This applies to all programs and is specific to the terminal driver.
Now where info like this should be documented is an interesting question.
Perhaps coreutils should take some responsibility for documenting such things?

Anyway some info for what is happening here...
Note there is no "record" distinction here.
The Ctrl-d combo just means "end input". I.E. send pending input to the program.
When there is text on the line already this is sent, and usually (as cat does 
too)
the program will read() again looking for more input. If you send pending input
on an empty line, then the program will get zero bytes and usually quit.
You can see this with:

  strace -e read cat

Note the Ctrl-d combo can be changed in the terminal driver
using the slightly misnamed eof stty setting:

  $ stty -a | grep eof
  intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;

cheers,
Pádraig





reply via email to

[Prev in Thread] Current Thread [Next in Thread]