阅读 man 手册遇到的问题,粗体字如何使用? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
lolcat
V2EX    Linux

阅读 man 手册遇到的问题,粗体字如何使用?

  •  
  •   lolcat 2021-02-12 23:58:45 +08:00 2543 次点击
    这是一个创建于 1713 天前的主题,其中的信息可能已经有所发展或是发生改变。

    linux 用了这么多年,我发现我 man 手册还不会用。

    我想查询 find 命令的正则表达式类型-regextype 选项的参数有哪些,man 手册介绍如下:

    -regextype type

    Changes the regular expression syntax understood by -regex and -iregex tests which occur later on the command line. To see which regular expression types are known, use -regextype help. The Texinfo documentation (see SEE ALSO) explains the meaning of and differences between the various types of regular expression.

    其中-regextype help 是粗体的,所以我以为是告诉我使用

    find -regextype help

    命令,就能看到已知的正则表达式类型,但是我敲这个命令后,终端却提示我:

    find -regextype help

    find: Unknown regular expression type ‘help’; valid types are ‘findutils-default’, ‘awk’, ‘egrep’, ‘ed’, ‘emacs’, ‘gnu-awk’, ‘grep’, ‘posix-awk’, ‘posix-basic’, ‘posix-egrep’, ‘posix-extended’, ‘posix-minimal-basic’, ‘sed’.

    help 是未知的参数,说明这个用法是错误的,虽然后面的提示告诉了我可以使用哪些参数,但 man 手册的原意肯定是通过 help 来获取详细正则表达式类型及其介绍的。

    请问如果我想了解-regextype 后面的参数有哪些,及那些参数的含义,我该如何查找?

    14 条回复    2021-02-17 21:42:29 +08:00
    lxilu
        1
    lxilu  
       2021-02-13 00:05:15 +08:00 via iPhone
    这不告诉你了吗
    lxilu
        2
    lxilu  
       2021-02-13 00:06:36 +08:00 via iPhone
    The Texinfo documentation (see SEE ALSO) explains the meaning of and differences between the various types of regular expression.
    omph
        3
    omph  
       2021-02-13 00:10:05 +08:00
    ( see SEE ALSO )
    最下面的备注里有解释
    lolcat
        4
    lolcat  
    OP
       2021-02-13 00:13:30 +08:00
    @lxilu 谢谢,我看 SEE ALSO 部分用 info find 命令找到正则表达式类型了。请问 man 手册中的-regextype help 粗体字有啥含义? man 手册为啥要我使用-regextype help ?
    lolcat
        5
    lolcat  
    OP
       2021-02-13 00:14:05 +08:00
    @omph 谢谢,我看 SEE ALSO 部分用 info find 命令找到正则表达式类型了。请问 man 手册中的-regextype help 粗体字有啥含义? man 手册为啥要我使用-regextype help ?
    lxilu
        6
    lxilu  
       2021-02-13 00:18:59 +08:00 via iPhone
    应该只是占位
    zlowly
        7
    zlowly  
       2021-02-13 00:35:14 +08:00   1
    看 find 的源码里,只要 regextype 后的参数没有匹配到已知类型,就会报错。其中源码里的那段代码注释是
    We didn't find a match for the type of regular expression that the user indicated they wanted. Tell them what the options are.
    所以理论上只要 regextype 后用任何非已知类型都能得到一样的信息,man 手册里可能只是为了用户方便记忆建议用 help 作为参数而已,无需做过多解读。
    asahui
        8
    asahui  
       2021-02-13 09:13:09 +08:00
    只是单纯英文问题,其实这里的加粗而且不是像 markdown 里的`code` 这样,就是单纯提配你去看-regextype 的 help,这里的 help 就是文档的意思,这句话不是叫你打`-regextype help`,而是查`-regextype`的 help
    omph
        9
    omph  
       2021-02-14 00:17:59 +08:00
    linux 是个自由的世界,包括命令的格式
    feedcode
        10
    feedcode  
       2021-02-14 19:01:22 +08:00   1
    恭喜你找到了一个文档的 bug,文档和行为不匹配
    lolcat
        12
    lolcat  
    OP
       2021-02-15 00:10:05 +08:00
    @feedcode 请问你这看的网页是 info find 显示的结果吧?在哪看 4.8 版本的 man find 显示的结果?
    feedcode
        13
    feedcode  
       2021-02-15 21:21:28 +08:00   1
    good question.
    网页是从 doc/find.texi 生成的 ( Texinfo is the official documentation format of the GNU project )
    http://www.gnu.org/software/texinfo/manual/texinfo/texinfo.html#Adding-Output-Formats
    > From time to time, proposals are made to generate traditional Unix man pages from Texinfo source. However, because man pages have a strict conventional format, creating a good man page requires a completely different source from that needed for the typical Texinfo applications of writing a good user tutorial and/or a good reference manual. This makes generating man pages incompatible with the Texinfo design goal of not having to document the same information in different ways for different output formats. You might as well write the man page directly.

    find 的 man 应该是 https://git.savannah.gnu.org/cgit/findutils.git/plain/find/find.1 , 里面还是过时的信息,:(
    FurN1
        14
    FurN1  
       2021-02-17 21:42:29 +08:00 via iPhone
    @feedcode 感谢。我看了这个帖子觉得楼主问的问题是有道理的,我也理解不了。楼上为文档的小错误辩解,我还以为我不会阅读了……
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     3750 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 25ms UTC 00:51 PVG 08:51 LAX 17:51 JFK 20:51
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86