4 ms·
>@ kill line I think I saw this in _The Unix Programming Environment_ by Kernighan and Pike. @ doesn't seem to do anything using various shells on any systems
by bitofhope 8y ago
>@ kill line
I think I saw this in _The Unix Programming Environment_ by Kernighan and Pike. @ doesn't seem to do anything using various shells on any systems I can quickly think of trying:
* /bin/sh (dash) on Linux on AMD64
* zsh on Linux on AMD64, NetBSD/amd64 (Xen domU), NetBSD/sparc64, Solaris 10 on Sparc64
* bash on Linux on AMD64
* /bin/sh on NetBSD/amd64 (Xen domU), NetBSD/sparc64, Solaris 10 on Sparc64, Tru64 V5.1 2650 on Alpha
* pdksh on OpenBSD on AMD64
None of those seemed to treat @ as anything special so I decided to go older, but…
* /bin/csh and /bin/sh on 4.3BSD on simh-vax780
…equally bust. Maybe I'm remembering the syntax wrong? I don't have the book with me now. Otherwise, wonder when this feature was removed? Probably after video terminals with erasable characters became commonplace.
- eponeponepon 8y agoI'm fairly sure that '@' is a character that's wandered around keyboards and character sets over the years - could it be that the command is a different character these days?
- nils-m-holm 8y agoThe @ character did kill a line back in the days where you typed your commands on a TTY -- that is a real TTY that printed your commands on a roll of paper. On a modern Unix you would use control-U.
- self 8y agoIt's from the System V Interface Definition standard. See page 625 in http://www.sco.com/developers/devspecs/vol1a.pdf http://www.sco.com/developers/devspecs/vol1a.pdf > During input, erase and kill processing is normally done. The ERASE character (by default, the # character) erases the last character typed. The WERASE character (CRTL-W) erases the last ‘‘word’’ typed in the current input line (but not any preceding spaces or tabs). A ‘‘word’’ is defined as a sequence of non-blank characters, with tabs counted as blanks. Neither ERASE nor WERASE will erase beyond the beginning of the line. The KILL character (by default, the @ character) kills (deletes) the entire input line, and optionally outputs a newline character. All these characters operate on a key stroke basis, independent of any backspacing or tabbing that may have been done. The REPRINT character (CTRL-R) prints a newline followed by all characters that have not been read. Reprinting also occurs automatically if characters that would normally be erased from the screen are fouled by program output. The characters are reprinted as if they were being echoed; consequencely, if ECHO is not set, they are not printed.
- pjc50 8y agoThis character is configurable with 'stty' and the 'termcap' system. If you do "stty -a" it will tell you what the kill character is - usually ^U. I suspect the default got changed round about the time '@' became used in email addresses.
- kbob 8y ago@ was actually the try driver's default kill character through 7th Edition or thereabouts. It was changed to ^U when CRT terminals became common, since those could actually erase the input, and there was no need to leave a visible marker showing killed text. I think the erasing behavior came from 2BSD. That's where I saw it first in Unix.
- bitofhope 8y agoYep, I assume the change was due to change from paper teletypes to CRT terminals. 2BSD is interesting, because that would make this likely a V7/SysIII/SysV poster since in 1983 they were already releasing 4.2BSD. The Unix Programming Environment was released in 1984 so that part might have confused BSD users already back when it was released! I wouldn't be surprised if AT&T continued with @ and # all the way to SVR4.