Talk:Line discipline
Add topic| This article is rated Stub-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||
| ||||||||||||||
^V
[edit]Is the use of ^V to insert a literal C0 control code part of the line discipline? If so, does this bear mentioning here? —ReadOnlyAccount (talk) 04:18, 9 January 2024 (UTC)
- It does not seem so. I just tested it, and it works in
bash, which disables line discipline to implement it on its own, but not in a self-written program that uses the terminal’s default facilities (as in: line discipline). - 2A02:3035:667:2085:BDE8:2CBA:92F5:8822 (talk) 19:43, 2 March 2025 (UTC)- It might not seem so, but it is. The history of the "standard" input processing for terminals on Unix-like systems is a bit long and complicated; see POSIX terminal interface § History for details.
- Line disciplines themselves didn't exist until Version 7 Unix; prior to that, there was only one wired-in "line discipline", which didn't have a "literal next" character like ^V. Version 7's standard line discipline also didn't have a "literal next" character"; those earlier systems just had
\, which escaped the erase and kill characters, as well as\itself, but didn't escape all special characters - it didn't escape the interrupt or quit characters, for example. - BSD introduced the "literal next" character, which escaped all special characters, along with a bunch of other things; I think that was in 4BSD, along with job control; that was supported by a separate line discipline that was a largely compatible superset of the original line discipline, which was still available. Over time, the BSDisms were adopted by most if not all Un*xes; I don't think any Unix-like systems remain that don't have them.
it works in
More precisely, it disables the line-editing functions of the line discipline to implement it on its own; the line discipline is still there, it just doesn't do erase/kill/word-erase/etc. processing, and also doesn't do echoing.bash, which disables line discipline to implement it on its ownbut not in a self-written program that uses the terminal’s default facilities
catalso uses the terminal's default facilities, and if you do
$ cat >/tmp/file ^V^M^V^M^V^M^V^J^V^J^V^C ^D
- (the ^Vs and the ^D will not appear on the terminal, as they won't be echoed, but in the above they represent what you type), and then do
$ od -bc /tmp/file
- you'll see
0000000 015 015 015 012 012 003 012
\r \r \r \n \n 003 \n
0000007
- which shows the three CRs, the two LFs, and the ^C in the file before the last LF.
- That was from macOS, but you should see that on any modern Unix-like system - Linux, *BSD, Solaris, AIX, etc.. Guy Harris (talk) 21:22, 4 January 2026 (UTC)
“some” Unix-“like” systems?
[edit]As far as I know, it exists in ALL Unix systems. Almost by definition.
Saying “Unix-like”, to then say “some”, is kinda like double negation.
It’s a Unix terminal thing that also got used in its… well… bad knock-offs. Because Those who do not understand Unix, recreate it. Badly.
Since I do not know the author’s intention, I’m going to leave it in, but strongly ask the author to rework the sentence to remove the double-negation-like style.
— 2A02:3035:667:2085:BDE8:2CBA:92F5:8822 (talk) 19:41, 2 March 2025 (UTC)
- Line disciplines first showed up in Version 7 Unix, so I changed it to state that; at this point, as far as I know, all Unix-like systems support them these days. Guy Harris (talk) 21:45, 4 January 2026 (UTC)
