cp 命令 -r 与 -R 选项的混淆与文档缺失
问题概述
用户对 cp 命令的 -r 与 -R 选项意义不明确,且文档缺失导致误用,尤其在复制特殊文件时会产生错误或挂起。多位评论者指出历史差异和官方手册的缺失,呼吁更清晰的说明。
痛点标签
- 对 -r 与 -R 选项的含义不明确
- 缺乏明确的官方文档说明
- 复制特殊文件时可能出错或导致进程挂起
待验证问题
- 是否有工具或文档能够明确解释 -r 与 -R 的区别并提供安全的复制示例?
- 用户是否愿意为此功能付费或更换现有工具?
- 是否需要一个交互式检查脚本来避免误用 cp 选项?
证据
原话 · @Anonymous
This blog post is odd because it keeps on hinting about a difference between `-r' and `-R' and links to the source code but never actually says what it is.
原话 · @Anonymous
Historic versions of the cp utility had an -r option. This implementation supports that option; however, its use is strongly discouraged, as it does not correctly copy special files, symbolic links or FIFOs.
原话 · @Anonymous
For those that don't know what 'copy as regular file' means, it means the copy command opens any file as though it was a regular file. If you have a FIFO queue sitting around it will read the content of the FIFO queue - if nothing writes to it, the command will hang. If you do cp -r /dev/zero foo, it will write zeroes into foo until the disk is full. -R otoh will copy a fifo queue as a fifo queue.
免责声明:本卡片由 AI 从社区讨论中提炼,属于「痛点证据」,是需求分析与验证的起点,不等同于「已验证的市场需求」。AI 存在分析局限,关键决策前请打开上方原始讨论人工复核。