Ask HN:为什么 README 文件里可复制的命令还用 $ 符号?
1 分•作者: garyfirestorm•10 个月前
我经常在文档或自述文件中遇到这种情况:
`$ ls -lt` 命令通常会带有一个复制按钮,你可以轻松点击它。但当你把它粘贴到终端时,它会显示为 `$ ls -lt`,其中多余的 `$` 导致错误,例如“找不到命令 $”之类的提示。
难道直接显示 `ls -lt` 不是更合理吗,这样就不用在前面加上 `$` 了吗?
查看原文
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?