You are not logged in.

#1 2018-01-13 03:51:32

spof
Member
Registered: 2016-02-18
Posts: 3

[SOLVED] ssh shows double prompts

I'm connecting to another Arch-Box via ssh. Once I'm connected I'm getting a kind of "double" bash prompt as shown below:

_pol@gemini:~\[pol@gemini ~]$ 

The first part before the backspace seems to get added by either ssh on my client or sshd on the host, changing $PS1 only changes the part behind the backspace.

this only happens on this specific combination of client and host. If I connect with another client, the prompt is fine, same if I connect to another host. Is there any option I didn't see to make this dissapear since that prompt starts taking up a lot of screen space once you start going deeper into the folder structure.

Let me know if I should provide you with any other information. Thanks in advance

Last edited by spof (2018-01-13 10:20:42)

Offline

#2 2018-01-13 04:44:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] ssh shows double prompts

What is the $TERM in the problematic host's session? And what is in the host's bashrc (or other initialisation files)?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2018-01-13 10:20:10

spof
Member
Registered: 2016-02-18
Posts: 3

Re: [SOLVED] ssh shows double prompts

Problem solved, /etc/bash.bashrc had the following in it:

#
# /etc/bash.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

[[ $DISPLAY ]] && shopt -s checkwinsize

PS1='[\u@\h \W]\$ '

case ${TERM} in
  xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'

    ;;
  screen*)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
    ;;
esac

[ -r /usr/share/bash-completion/bash_completion   ] && . /usr/share/bash-completion/bash_completion

removing the case statement got rid of the double prompt. I didn't think to check the global bashrc since I assumed the one in my homefolder would override the global one.

Offline

#4 2018-01-13 10:33:16

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: [SOLVED] ssh shows double prompts

To be honest, I don't think that the global bashrc would cause that behaviour (otherwise this would be a bug). What is your user's bashrc?


pkgs │ hacks │ cfg │ blag

Offline

#5 2018-01-13 10:50:21

spof
Member
Registered: 2016-02-18
Posts: 3

Re: [SOLVED] ssh shows double prompts

Users .bashrc:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

I found it weird as well, but since removing that case statement fixed it, I can only assume that was the cause

Offline

Board footer

Powered by FluxBB