Skip to content

Commit a9f296d

Browse files
committed
Eliminate subshell in zsh
1 parent d72c442 commit a9f296d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

polyglot.sh

Lines changed: 2 additions & 2 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]=$(print -P '@%m')
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%?${POLYGLOT_HOSTNAME_STRING#*.}}"
539+
POLYGLOT_HOSTNAME_STRING="@${POLYGLOT_HOSTNAME_STRING%%.*}"
540540
else
541541
POLYGLOT_HOSTNAME_STRING=''
542542
fi

0 commit comments

Comments
 (0)