Skip to content

Commit

Permalink
Escape `.'
Browse files Browse the repository at this point in the history
  • Loading branch information
agkozak committed Jan 15, 2020
1 parent a9f296d commit 3c93f3a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions polyglot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ if [ "$ZSH_VERSION" ] && [ "$0" != 'ksh' ] \

# Only display the $HOSTNAME for an ssh connection, except for a superuser
if _polyglot_is_ssh || _polyglot_is_superuser; then
psvar[1]=${HOST%%.*}
psvar[1]=${HOST%%\.*}
else
psvar[1]=''
fi
Expand Down Expand Up @@ -536,7 +536,7 @@ elif [ "$KSH_VERSION" ] || _polyglot_is_dtksh || [ "$ZSH_VERSION" ] \
# Only display the $HOSTNAME for an ssh connection
if _polyglot_is_ssh || _polyglot_is_superuser; then
POLYGLOT_HOSTNAME_STRING=$(hostname)
POLYGLOT_HOSTNAME_STRING="@${POLYGLOT_HOSTNAME_STRING%%.*}"
POLYGLOT_HOSTNAME_STRING="@${POLYGLOT_HOSTNAME_STRING%%\.*}"
else
POLYGLOT_HOSTNAME_STRING=''
fi
Expand Down Expand Up @@ -632,7 +632,7 @@ elif _polyglot_is_pdksh || [ "$0" = 'dash' ] || _polyglot_is_busybox \
# Only display the $HOSTNAME for an ssh connection
if _polyglot_is_ssh || _polyglot_is_superuser; then
POLYGLOT_HOSTNAME_STRING=$(hostname)
POLYGLOT_HOSTNAME_STRING="@${POLYGLOT_HOSTNAME_STRING%?${POLYGLOT_HOSTNAME_STRING#*.}}"
POLYGLOT_HOSTNAME_STRING="@${POLYGLOT_HOSTNAME_STRING%%\.*}"
else
POLYGLOT_HOSTNAME_STRING=''
fi
Expand Down

0 comments on commit 3c93f3a

Please sign in to comment.