3 ms·
Yeah. About the only relevant bit is that root prompts tend to use # as part of their prompt precisely to inject a comment character in case of mis-quotes/paste
by rcarmo 6y ago
Yeah. About the only relevant bit is that root prompts tend to use # as part of their prompt precisely to inject a comment character in case of mis-quotes/pastes.
- minitoar 6y agoWow I never heard that! I always thought it was just some arbitrary convention I guess.
- rcarmo 6y agoI _think_ it started becoming commonplace around the early days of X11, although to be fair # and $ are neighbors on pretty much any keyboard layout.
- alpaca128 6y ago> # and $ are neighbors on pretty much any keyboard layout Aside from ISO QWERTY, AZERTY and at least 3 different QWERTZ variants, among others.
- jodrellblank 6y agoNot UK layout; shift-3 is £ and # is next to enter. \ @ and " are in their proper positions on a UK layout as well. :| https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fquietpc.co.uk%2Fimages%2Fproducts%2Fmatias-quiet-pro-keyboards-10-large.jpg&f=1&nofb=1 https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2F...
- nemosaltat 6y agoThis is why I hang out here! Obligatory XKCD: https://xkcd.com/1053/ https://xkcd.com/1053/
- reaperducer 6y agoThis is getting to be a tired meme. While it doesn't apply to shell prompts, there are such things as cultural memory and institutional memory. As a member of a group or society, you are expected to have a certain baseline amount of knowledge of that culture and history. When I was young, it was considered shameful not to know things. Now the people I work with seem to wear ignorance as a badge of pride. They think that not knowing something means that thing is not worth knowing. As if somehow not knowing something is a good thing.
- chriswarbo 6y ago> Now the people I work with seem to wear ignorance as a badge of pride. They think that not knowing something means that thing is not worth knowing. As if somehow not knowing something is a good thing. That may be the case, due to attitudes encouraged by pop culture, etc. but it's a disastrously incorrect understanding of the comic (and parent comment). They're celebrating learning, which is the exact opposite of 'wearing ignorance as a badge of pride'. > When I was young, it was considered shameful not to know things. Shaming something discourages people from admitting it. A child who's ashamed to ask questions will not learn as effectively. They may learn to avoid admitting their ignorance, but that may cause problems later (struggling alone rather than asking for help, possibly leading to damage or injury, etc.). > there are such things as cultural memory and institutional memory. As a member of a group or society, you are expected to have a certain baseline amount of knowledge of that culture and history. How do you think the members of those groups have that knowledge? We have not (yet) evolved a genetic predisposition to grow, in utero, neuronal bundles encoding Unix shell prompt escape sequences. That's the point; everyone has all need to learn! Still, it's better to air and discuss such takeaways!
- inopinatus 6y agoThere’s a huge gulf between admitting you don’t know something, and being proud of it. Suggesting it was ever, or should be, somehow “shameful” to admit not knowing something, is an enemy of change and growth, and in everyday life becomes a recipe for perpetuating structural in-groups and all the systemic pathologies that go along with them. I am also grumpy old fart but I was raised in an engineering culture that was not afraid to ask “what’s a spline?”, and I don’t regret it.
- taviso 6y agoI've heard this story before, but I don't think it's true. I think the bourne shell copied # comments from csh, which had them first. When sh first implemented them, # comments only worked in scripts, not if you typed them at the shell (i.e. if isatty(0), then # wasn't special). The fact that the prompt came before comments, and that comments didn't work interactively really makes the story sound suspect! I don't know the origin of # in csh, but I would guess it was chosen because it looks like a CPP directive.
- kragen 6y agoHmm, wasn't # the default erase character for teletype-era Unix? And @ the "kill" character (like modern ^U)? That would have made them a little annoying to type—not annoying enough to keep them from being used for cpp, though, and https://github.com/memnoth/unix-v6/blob/master/sys/dmr/tty.c#L30 https://github.com/memnoth/unix-v6/blob/master/sys/dmr/tty.c... suggests that you could type \#. (There was no "lnext" yet; it was just hardcoded to backslash.) The actual input erase handling is on https://github.com/memnoth/unix-v6/blob/master/sys/dmr/tty.c#L220 https://github.com/memnoth/unix-v6/blob/master/sys/dmr/tty.c.... The relevant struct member is declared in https://github.com/memnoth/unix-v6/blob/master/sys/tty.h#L35 https://github.com/memnoth/unix-v6/blob/master/sys/tty.h#L35 and initialized to CERASE in each tty driver, for example, https://github.com/memnoth/unix-v6/blob/master/sys/dmr/kl.c#L60 https://github.com/memnoth/unix-v6/blob/master/sys/dmr/kl.c#..., using the macro defined in https://github.com/memnoth/unix-v6/blob/master/sys/tty.h#L48 https://github.com/memnoth/unix-v6/blob/master/sys/tty.h#L48. So by default # was special, just to the kernel tty driver, not the shell.
- rcarmo 6y agoThat's a fair point. But in the 90s as a System V and SunOS user, I saw some discussions happen on Usenet, and by the time X was commonplace, the myth/rationale was commonplace.
- JdeBP 6y agoEven then, though, that was over a decade after the fact, and people were inventing explanations for things retroactively. Doug McIlroy has put the kibosh on this myth. * https://minnie.tuhs.org/pipermail/tuhs/2017-April/011286.html https://minnie.tuhs.org/pipermail/tuhs/2017-April/011286.htm...
- Aeolun 6y agoPotentially, but I can pretty much guarantee that someone working on any shell has run into this problem before, and then decided not to change the # because it was so damned convenient for preventing mispastes.
- gdavisson 6y agoThat implies you should put a space before the # in the root prompt, because it's not recognized as a comment delimiter if it's in the middle of a "word".