瀏覽代碼

[F] Fix hostname compatibility

https://github.com/dylanaraps/neofetch/pull/2095
https://github.com/dylanaraps/neofetch/issues/2094
Azalea (on HyDEV-Daisy) 2 年之前
父節點
當前提交
ccecf6424d
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      neofetch

+ 4 - 1
neofetch

@@ -1604,7 +1604,10 @@ get_title() {
 
     case $title_fqdn in
         on) hostname=$(hostname -f) ;;
-        *)  hostname=$(hostname | cut -d. -f1);;
+        *)  
+            hostname=${HOSTNAME:-$(hostname)}
+            hostname=${hostname%.*}
+        ;;
     esac
 
     title=${title_color}${bold}${user}${at_color}@${title_color}${bold}${hostname}