mailx(1) is a hard link to mail(1) in base system.

Hi everybody!

I'm running FreeBSD 13.4 and I see that /usr/bin/mailx is just a hard link for /usr/bin/mail:

$ ls -l /usr/bin/mail /usr/bin/mailx
-r-xr-xr-x 3 root wheel 105896 Sep 13 11:12 /usr/bin/mail
-r-xr-xr-x 3 root wheel 105896 Sep 13 11:12 /usr/bin/mailx

As far as I know, mailx (according to its port mail/mailx) is a mail(1) with some extra extensions. Piping messages (| command) is one of those I lack in mail(1). I checked out if mail(1), that is shipped as part of a base system, allows piping and doesn't. But, I found, that mailx is in the base system too, so I tried it and... it doesn't support piping either ('cause they're hard links). Well, according to mail(1) manpage (which is the same for mailx(1)): "Usually, mail is just a link to Mail and mailx, which can be confusing.". But if mail(1) is a link to mailx(1) then it should have a piping feature, shouldn't it?

OK, I just decided to install mailx from ports, but I encountered an issue: when I type `which mailx` it says me that it is in /usr/bin/mailx (which, as we've just seen, does not have mailx features somehow). I tried to invoke /usr/local/bin/mailx at it works fine.

So, guys, I got 2 questions actually, maybe some of you know the answers:

1. Why doesn't mailx(1), that is in the base system, actually have mailx features (piping at least)? In other words, why don't mail(1) and mailx(1) differ?

2. How shall I replace system mailx (/usr/bin/mailx) with one from ports (/usr/local/bin/mail) properly? I mean, would linking a system program to a local one be a good idea?
2.1 Sort of off-topic, but I also wonder about general idea of question 2: is it a (a proper, maybe) way to replace some base program (say, ed(1)) with its ports version or even with its version compiled from source? How would you guys do it?

Thank you!

Best,
Artem
 
Charlie_,

Thank you for useful links!

Well, I've tried mail/mailx and it works just fine for me, so I'm gonna to stick with it. Till I find it doesn't fit my needs.

I'm more like wondering why mailx, which is in the base doesn't have thoose extensions it ought to have as mail*x*? If it doesn't actually differ from ordinary mail(1), what's the matter of that "x" in the name then?

Artem
 
Back
Top