What is the difference between $man and man on a mac

1

0

On a terminal, the commands $man and man seem to do slightly different things.

For example $man open vs. man open. It looks like $man is the same as man except it prints the output directly instead of opening it in vim.

Is there something universal about a $ prefix? Is there some other difference between the two programs?

Below is the output when using type

~
$ type $man
~
$ type man
man is hashed (/usr/bin/man)

Qiming

Posted 2016-03-15T20:31:25.947

Reputation: 113

Answers

3

man is an external command that displays manual page for a given argument. Thus man open displays a manual page for open command.


$man is a variable which value you can check using echo $man.

If the value of $man is empty then executing $man open is the same as executing open.

/usr/bin/open command executed without arguments displays simple help.

techraf

Posted 2016-03-15T20:31:25.947

Reputation: 4 428

Oh I see, I happened to catch myself in a potentially confusing scenario. Thanks for clarifying. – Qiming – 2016-03-15T21:08:06.490