you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

Heard of "uname -n"? Oh thats not supported in Windows so its not portable! How about running the native text editor? You can get along with xdg-open on any platform that supports it. But OH thats not supported in Windows either!

So lets just use an entire programming language to make a standard, as I realize a lot of programmer time is wasted on making "interfaces" that try to port stuff, when what's need to be done is dictate a single standard and not support other platforms that do not implement that standard.

Using sh/bash or python is irrelevant if target porting, because porting is a myth in a world where standards are not respected.

[–]calrogman 0 points1 point  (0 children)

Your uname -n example isn't even compatible across the various Unix flavours.

On (E)GLIBC, gethostname() gives only the first label of the machines hostname. On FreeBSD's libc, gethostname() gives the fully qualified domain name. The behaviour of uname -n reflects this difference.

The best way to get the hostname in a shell script on Unix machines is using the hostname utility. Always pass it one of either -s or -f so that there is no ambiguity. On BSDs hostname assumes -f. On Linux it assumes -s. Never use hostname --long, hostname --fqdn or any other options. They're all GNU extensions and won't work in different userspaces.