在登录系统的时候,会执行/etc/bashrc
      1 # /etc/bashrc
      2
      3 # System wide functions and aliases
      4 # Environment stuff goes in /etc/profile
      5
      6 # It's NOT a good idea to change this file unless you know what you
      7 # are doing. It's much better to create a custom.sh shell script in
      8 # /etc/profile.d/ to make custom changes to your environment, as this
      9 # will prevent the need for merging in future updates.
     10
     11 # are we an interactive shell?
     12 if [ "$PS1" ]; then
     13   if [ -z "$PROMPT_COMMAND" ]; then
     14     case $TERM in
     15     xterm*)
     16         if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
     17             PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
     18         else
     19             PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'

在19行 ${HOSTNAME%%.*}  这个是截取hostname变量中第一个.号前面的字段

所以设置了带有.的主机名,也不会显示第一个.号后面的字符,例如:

hostname  hello.helloworld
登录系统的时候会显示
[root@hello ~]#
而不会显示
[root@hello.helloword~]#

原因就是上面的脚本导致的。