Skip to content

Commit 3c93f3a

Browse files
committed
Escape `.'
1 parent a9f296d commit 3c93f3a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

polyglot.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ if [ "$ZSH_VERSION" ] && [ "$0" != 'ksh' ] \
420420

421421
# Only display the $HOSTNAME for an ssh connection, except for a superuser
422422
if _polyglot_is_ssh || _polyglot_is_superuser; then
423-
psvar[1]=${HOST%%.*}
423+
psvar[1]=${HOST%%\.*}
424424
else
425425
psvar[1]=''
426426
fi
@@ -536,7 +536,7 @@ elif [ "$KSH_VERSION" ] || _polyglot_is_dtksh || [ "$ZSH_VERSION" ] \
536536
# Only display the $HOSTNAME for an ssh connection
537537
if _polyglot_is_ssh || _polyglot_is_superuser; then
538538
POLYGLOT_HOSTNAME_STRING=$(hostname)
539-
POLYGLOT_HOSTNAME_STRING="@${POLYGLOT_HOSTNAME_STRING%%.*}"
539+
POLYGLOT_HOSTNAME_STRING="@${POLYGLOT_HOSTNAME_STRING%%\.*}"
540540
else
541541
POLYGLOT_HOSTNAME_STRING=''
542542
fi
@@ -632,7 +632,7 @@ elif _polyglot_is_pdksh || [ "$0" = 'dash' ] || _polyglot_is_busybox \
632632
# Only display the $HOSTNAME for an ssh connection
633633
if _polyglot_is_ssh || _polyglot_is_superuser; then
634634
POLYGLOT_HOSTNAME_STRING=$(hostname)
635-
POLYGLOT_HOSTNAME_STRING="@${POLYGLOT_HOSTNAME_STRING%?${POLYGLOT_HOSTNAME_STRING#*.}}"
635+
POLYGLOT_HOSTNAME_STRING="@${POLYGLOT_HOSTNAME_STRING%%\.*}"
636636
else
637637
POLYGLOT_HOSTNAME_STRING=''
638638
fi

0 commit comments

Comments
 (0)