Improve portability of `hostname` (#23)

This commit is contained in:
Tim Byrne 2016-09-09 16:32:35 -05:00
parent 0a5741df8f
commit fd77d024dd
No known key found for this signature in database
GPG Key ID: 6CBE24C2FD8CF76E
1 changed files with 2 additions and 1 deletions

3
yadm
View File

@ -104,7 +104,8 @@ function alt() {
#; regex for matching "<file>##SYSTEM.HOSTNAME.USER"
match_system=$(uname -s)
match_host=$(hostname -s)
match_host=$(hostname)
match_host=${match_host%%.*} #; trim any domain from hostname
match_user=$(id -u -n)
match="^(.+)##($match_system|$match_system.$match_host|$match_system.$match_host.$match_user|())$"