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.

  • 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. – Ture Pålsson Nov 09 '22 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. – user1934428 Nov 09 '22 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). – Charles Duffy Nov 09 '22 at 16:25
  • @user1934428 I’ve updated the description about my dir structure and my command of execution. – jimmymcheung Nov 09 '22 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? – Charles Duffy Nov 09 '22 at 16:26
  • @CharlesDuffy thanks for suggestion, I tried `which man` which gives exact output as on other machines running `bash`. I think after following the comments that my thought should be a bit different, the problem might be the version of `man` macOS Ventura used. Will check that – jimmymcheung Nov 09 '22 at 16:29
  • Ventura still ships bash. If you haven't tried bash-on-Ventura, you haven't really tried both shells with all else being equal. (Because yes, I agree, this is almost certainly a `man` change). – Charles Duffy Nov 09 '22 at 16:31
  • I still don't see how you call up the man page, and how you have set your MANPATH. – user1934428 Nov 10 '22 at 07:48
  • One more point to consider: Did you do a `man -u` or `mandb`? – user1934428 Nov 10 '22 at 07:50
  • @user1934428 the `./func` is pointing to the manpage (I was in the dir `man/`), the the relative path from project repo is `man/func`. Tried to rename manpage to `func.1` not working. However with `mandoc -Tpdf` the generated pdf has the proper format as seen in other bash running machine. – jimmymcheung Nov 10 '22 at 13:55
  • What doès it mean that a file `func` is **pointing** to a man-page-file. Do you mean that one of them is a symbolic link to the other, and this does not make sense. – user1934428 Nov 11 '22 at 07:59
  • And, I don't know how we have to repeat it: Why don't you show your MANPATH settings? Is this a company secret that you don't want to share this information with us? – user1934428 Nov 11 '22 at 08:01
  • By pointing I mean the `./func` file is the manpage file. For the second question, the default MANPATH is either unset or system default, since the one who owns the macOS 13 machine has no CLI experience. – jimmymcheung Nov 11 '22 at 09:37

1 Answers1

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 ]