0

I've recently wrote a manpage, which display properly in bash shell. However, in zsh the man return an error message: /bin/zsh: can't open input file: man. Is there a difference in man syntax between zsh and bash? Below is an shorten example.

.\" 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

———————— Update ————————

The man page is stored within the project repo, the problem occurs when checking if the doc generated display properly. The repo tree is like below:

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

The page is check by

man $ man ./func

In macOS 12 terminal (/bin/bash) and the ubuntu running as Win-subsystem (/bin/bash) the page can be display properly (tested on different machine). However, in macOS 13 terminal (/bin/zsh) the file cannot be opened by man. Current consideration is either macOS 13 contain a different version of man, or it is due to the change in zsh.

———————— Update ————————

$ mandoc -Tpdf "$(man -w ./func)"

produce properly formatted pdf.

Moreover, on the macOS 13 running zsh, man -V or man --version given an error. However, man for build-in command is working properly.

13
  • How, exactly, are you trying to display this manpage? If I write your file into ./man1/foo.1, and then run MANPATH=. man foo, it displays fine. Commented Nov 9, 2022 at 11:32
  • 3
    man is not a shell internal command. How could then the invocation syntax be different? You did not write how you invoked the man in your case, where you have stored the man-page, and how you have set MANPATH, so I don't think one can point out the error. Commented Nov 9, 2022 at 11:52
  • 1
    As user1934428 says -- man is the same command no matter which shell starts it (at least, it is so long as bash's type man and zsh's which man point to the same place). Commented Nov 9, 2022 at 16:25
  • @user1934428 I’ve updated the description about my dir structure and my command of execution. Commented Nov 9, 2022 at 16:25
  • ...but maybe run /usr/bin/man ./func explicitly if you want to prevent any aliases or function wrappers from getting in the way? Commented Nov 9, 2022 at 16:26

1 Answer 1

0

After reading comments here and seeing this answer, I think the problem was not due to the difference between zsh and bash, but rather due to the removal of groff in the macOS 13, So I would need a alternative solution for inline-formatting my manpage or figure out why the following command would produce extra space around.

[
.B -abc
]

(gives following output with -abc being bolded)

[ -abc ]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.