-1

My bash function no longer works properly since migration to M2 processor.

I cannot get it to convert into a pdf file, because it keeps adding my home directory into the parameter after the -t argument. How do I fix this?

pman () {
        man -t "${1}" | open -f -a /System/Applications/Preview.app
}
man -t "${1}" | open -F -a /System/Applications/Preview.app  ping
The file /Users/name/ping does not exist.
What manual page do you want?
AEGIS
  • 162
  • 1
  • 3
  • 17
  • 3
    If this is mac, tag it as such. – konsolebox Feb 07 '23 at 20:21
  • How exactly are you using this function? It looks from what you have here like you defined it, then rather than using it you re-entered the function's contents and put "ping" after that -- which is not how you run a function at all. – Gordon Davisson Feb 09 '23 at 00:24
  • Pman ping. Is how I used to use in on Monterey 2015 MacBook Pro. I bought a 2022 m2 MacBook Pro with Ventura. This made it so so many of my shells scripts and .bash_profile were not working. I tired the function outside of it, but it gave me that error. I figured I would try it a different way. – AEGIS Feb 10 '23 at 00:13

2 Answers2

1

You can check the value of the environment variable "MANPATH". That probably has your ${HOME} as the first/only path.

You can override that by re-setting the default value for your OS, and it should work fine.

You could also check on the guidance provided in /etc/manpath.config .

Eric Marceau
  • 1,601
  • 1
  • 8
  • 11
0
 pman() {     mandoc -T pdf "$(/usr/bin/man -w $@)" | open -fa Preview; }

This is because they altered the rendering of .ps to .pdf in the preview app for Ventura.

AEGIS
  • 162
  • 1
  • 3
  • 17