←back to thread

217 points tanelpoder | 1 comments | | HN request time: 0.204s | source
Show context
jandrese ◴[] No.26492618[source]
This seems to be more of "don't paste garbage into a terminal, especially as root." With a sidenote that it might be safer if your custom application command interpreter didn't use > as the prompt character. I note that Bourne shell defaults to the safer % and # characters for the prompt. The # character for root is especially safe.
replies(6): >>26492739 #>>26492951 #>>26494723 #>>26499063 #>>26499191 #>>26501459 #
rcarmo ◴[] No.26492739[source]
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.
replies(2): >>26492855 #>>26496214 #
minitoar ◴[] No.26492855[source]
Wow I never heard that! I always thought it was just some arbitrary convention I guess.
replies(4): >>26494208 #>>26494966 #>>26494988 #>>26498663 #
taviso ◴[] No.26494988[source]
I'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.

replies(4): >>26495178 #>>26495629 #>>26495972 #>>26528534 #
rcarmo ◴[] No.26495178[source]
That'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.
replies(1): >>26498466 #
1. JdeBP ◴[] No.26498466[source]
Even 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.htm...