zsh iterm2_hostname can not be overridden
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: 3.3.9
- OS version: 10.15.4
What happened:
- export iterm2_hostname="myhostname" # before the zsh shell integration
- after sourcing the shell integration, iterm2_hostname is reset to the hostname value
What should have happened:
- export iterm2_hostname="myhostname" # before the zsh shell integration
- after sourcing the shell integration, iterm2_hostname is unchanged, still "myhostname"
The zsh shell integration has a bug: Current implementation:
# If hostname -f is slow on your system, set iterm2_hostname prior to sourcing this script.
[[ -z "${iterm2_hostname-}" ]] && iterm2_hostname=`hostname -f 2>/dev/null`
# some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option
if [ $? -ne 0 ]; then
iterm2_hostname=`hostname`
fi
But should be:
# If hostname -f is slow on your system, set iterm2_hostname before sourcing this script.
if [ -z "${iterm2_hostname-}" ]; then
iterm2_hostname=`hostname -f 2>/dev/null`
# some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option
if [ $? -ne 0 ]; then
iterm2_hostname=`hostname`
fi
fi
Note that the bash implementation correctly uses the version just above.The only difference being that it is using $() instead of ``
Edited by George Nachman