4 ms·
Ask HN: Why do readmes still use $ in copy-pasteable commands?
I often encounter this in docs/readmes
`$ ls -lt` often renders with a copy button that you can easily click and when you paste it in terminal it shows up as `$ ls -lt` with an unnecessary $ causing an error $ command not found or something like that...
wouldn't it make sense to just have `ls -lt` and not add the $ in front of it?
- deleted 1y ago[deleted]
- rzzzwilson 1y agoThe "$" prompt is shorthand to indicate the command is run as a non-root user. If you see "# ls -lt" that indicates the command should be run as root. The problem lies with whoever set up the copy button to include the prompt as part of the copied command.
- garyfirestorm 1y agothis is a widespread problem - many libraries, git repos follow this convention unfortunately
- gibbitz 1y agoHow do you specify this on GitHub markdown?
- perrygeo 1y agoIt's used in documentation mostly to distinguish the command from stdout. And it's verbatim what you see if you copy-paste from most default bash shells.