Closed mgrubb closed 7 years ago
Interesting, I didn't know this about Solaris. I hope you didn't somehow set your hostname to -s
.
I've pushed a commit to the exp
experimental branch. Let me know if this version seems to work for you.
Well, I have come across this before when writing my own scripts and wondering why my hostname kept changing to '-s' on solaris :) so I thought I would pass along my experience proactively.
This will happen on Linux as well.
@ThomasAdam I'm curious about which Linux distros do not support the -s
parameter. Regardless, the change I've made will be universal—so this should end up working everywhere.
I can help by adding that it doesn't work with Void Linux.
It looks like the issue is that the "basic" hostname from coreutils doesn't support any options [link].
@spcutrell When you said "it doesn't work with Void Linux", do you mean 1.05 doesn't work because of hostname problems? Or do you mean that the planned 1.06 version (https://github.com/TheLocehiliosan/yadm/commit/ea6291a9866fc5dad84994624d40231acfbd75e2) does not work with Void Linux?
Sorry, I should have been more clear. I mean 1.05. I see no reason why 1.06 won't work. I will actually be able to confirm it for you tonight if you'd like.
I was mostly just responding to add more clarity to the problem (why -s
doesn't work on some distros) and to give an example of a distro that it didn't work on.
This change is now in the dev
branch, staged for 1.06
a more portable solution would be to either use: $(hostname | sed -e 's/..$//') or since you are depending on bash: hostname=$(hostname) hostname=${hostname%%.} though the first option is more concise