-1

So in my .bash_profile I'm using the following to show my user@hostname + the pwd in my Winterms/XWsh terminal title.

export PROMPT_COMMAND='echo -ne "\033P1.y$USER@$HOSTNAME: $PWD \033\\"'

This works fine in Irix but if I attempt to ssh into my Irix box I'm greeted with the following:

1.ys0ke@bosco: /usr/people/s0ke s0ke@bosco ~$

Which I understand that it's running the PROMPT_COMMAND so that is executed before the printing of each primary prompt. But my question is there any way to get rid of this when attempting to to connect from another box? Essentially I would just like the user@hostname displayed instead of the entire user@host + pwd when I am using ssh.

mcgoosh
  • 59
  • 1
  • 2
  • 11
  • 1
    You can modify your `PS1` directly, functionality for which you seem to duplicate in your prompt command. – Benjamin W. Mar 17 '21 at 19:29
  • 3
    You shouldn't use PROMPT_COMMAND to output a prompt because it will cause line editing not to work correctly. If you instead set PS1, you'll have correct line editing and also avoid this duplication. – that other guy Mar 17 '21 at 20:10

2 Answers2

1

But my question is there any way to get rid of this when attempting to to connect from another box?

So do not export the PROMPT_COMMAND, so that child processes will not inherit it. Remove the export.

KamilCuk
  • 120,984
  • 8
  • 59
  • 111
  • From my remote box I have set up a small script to unset PROMPT_COMMAND when I ssh into the IRIX box. – mcgoosh Mar 18 '21 at 16:15
0

bash has the ability to desplay user and hostname already built into its prompting system. See the bash man-page, section "PROMPTING":

          \h     the hostname up to the first `.'
          \H     the hostname
          \u     the username of the current user
user1934428
  • 19,864
  • 7
  • 42
  • 87