You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

zsh与bash的man手册语法是否存在差异?本地手册打开异常排查

关于zsh与bash中man命令加载本地手册文件的差异问题

问题现象

  • 在bash环境(macOS 12终端、WSL Ubuntu)中,执行man ./func可正常显示自定义的func man手册
  • 在macOS 13的zsh环境中执行同一命令,报错:/bin/zsh: can't open input file: man

自定义man手册内容

." Manpage for func.
.TH func 1 "08 Nov 2022" "1.0" "func man page"
.SH NAME
\fBfunc\fR - short desc.

.SH SYNOPSIS
\fBfunc\fR [\fB-h\fR] [\fB-D\fR \fIpath/to/destination\fR]

.SH DESCRIPTION
\fBiid_query.sh\fsome # more '\fIabc\fR'. other '\fI_abc\fR' continue name\*(lq\fI./abc\fR\*(rq.
.br
.B "    some    other"

.SH OPTIONS
\fB-D\fR \fIpath/to/destination\fR
.br
    The path of the destination directory.
.LP
\fB-h\fR
.br
    Display the usage.

.SH BUGS
No known bugs.

.SH AUTHOR
Someone

项目目录结构

parent
|
+———— src
|      |
|      +—— func
|
+———— man
       |
       +—— func # manpage for func

补充信息

  • macOS 13 zsh环境中,man -V或man --version会报错,但查看系统内置命令的手册功能正常
  • 在该环境中执行mandoc -Tpdf "$(man -w ./func)",可生成格式正确的PDF手册

内容的提问来源于stack exchange,提问作者jimmymcheung

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 00:50:27