Re: [PATCH v2] send-email: try to get fqdn by running hostname --fqdn on Linux and macOS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 12 May 2025, at 1:16 PM, Julian Swagemakers <julian@xxxxxxxxxxxxxxx> wrote:
> 
> On Sat May 10, 2025 at 9:37 AM CEST, Aditya Garg wrote:
>> `hostname` is a popular command available on both Linux and macOS. As
>> per the man-page[1], `hostname --fqdn` command returns the fully
>> qualified domain name (FQDN) of the system.
> 
> There are multiple implementations of the hostname command, and they
> don't all support `--fqdn`. For example this will not work on Alpine
> Linux as well as macOS.
> 
> macOS:
> 
>    $ hostname --fqdn
>    hostname: illegal option -- -
>    usage: hostname [-f] [-s | -d] [name-of-host]
> 
> Alpine:
> 
>    $ hostname --fqdn
>    hostname: unrecognized option: fqdn
>    BusyBox v1.37.0 (2025-01-17 18:12:01 UTC) multi-call binary.
> 
>    Usage: hostname [-sidf] [HOSTNAME | -F FILE]
> 
>    Show or set hostname or DNS domain name
> 
>        -s    Short
>        -i    Addresses for the hostname
>        -d    DNS domain name
>        -f    Fully qualified domain name
>        -F FILE    Use FILE's content as hostname
> 
> All seem to support `-f` though, maybe that would be the better option.

Sure. I was using -f before, but thought --fqdn would be more intuitive for
anyone reading the code. Didn't know its not supported every where.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux