From 9644993eaedec22b1d00a02c280b6a464a45efa4 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 1 Apr 2011 01:33:22 +0200 Subject: compatibility fix with openbsd hostname returns the fqnd on openbsd, befor using it as screen title discard the domain part --- bashrc/common/prompt.sh | 3 ++- bashrc/common/screen.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'bashrc/common') diff --git a/bashrc/common/prompt.sh b/bashrc/common/prompt.sh index 86f6919..c85f62b 100644 --- a/bashrc/common/prompt.sh +++ b/bashrc/common/prompt.sh @@ -99,7 +99,8 @@ __make_prompt() { export PS1="${PS1UH} ${PS1BO}${PS1R}${PS1F}${PS1BC} ${PS1D} ${s}${PS1P}" if [[ "${TERM#screen}" != "${TERM}" ]]; then - echo -ne "\ek$(id -un)@$(hostname)\e\\" + _hostname=$(hostname) + echo -ne "\ek$(id -un)@${_hostname%%\.*}\e\\" fi } diff --git a/bashrc/common/screen.sh b/bashrc/common/screen.sh index 6dbda21..72bc13d 100644 --- a/bashrc/common/screen.sh +++ b/bashrc/common/screen.sh @@ -3,7 +3,8 @@ set_screen_title() { # prevent reset_screen_title from calling set_screen_title if [[ $BASH_COMMAND != "__make_prompt" ]]; then - echo -ne "\ek$(id -un)@$(hostname):${BASH_COMMAND/ *}\e\\" + _hostname=$(hostname) + echo -ne "\ek$(id -un)@${_hostname%%\.*}:${BASH_COMMAND/ *}\e\\" fi } -- cgit v1.2.3