tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: default remote shell in tramp


From: Vinh Nguyen
Subject: Re: default remote shell in tramp
Date: Sat, 19 Jun 2010 07:28:51 -0700

On Sat, Jun 19, 2010 at 3:44 AM, Michael Albinus <address@hidden> wrote:
> Vinh Nguyen <address@hidden> writes:
>
>>> What do you mean with this? It should open a new bash shell, and show
>>> you the prompt. Like this:
>>>
>>> host:~> exec env ENV='' PROMPT_COMMAND='' PS1=\#\$\ PS2='' PS3='' /bin/bash
>>> address@hidden:~$
>>>
>>> Best regards, Michael.
>>
>> Yes, I was expecting that, but it didnt do so (I think).  Tried it on
>> 2 different servers.  I don't think it open a new bash shell because
>> entering 'exit' closes me out of the server.
>
> That's OK. "exec" means "replace the running shell by the called
> program", so it is OK that you exit directly from the opened bash.
>
> I suspect, that you set your prompt in ~/.bashrc. You should check,
> whether ~/.bashrc is handled by Tramp, for example by checking the used
> $TERM. Something like this at then end of ~/.bashrc:
>
>   [ "$TERM" = "dumb" ] && PS1='$ '
>

So what are you suggesting I do here?

I see the following with $TERM in my .bashrc:

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac
...
# If this is an xterm set the title to address@hidden:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)address@hidden: \w\a\]$PS1"
    ;;
*)
    ;;
esac


and on another remote host:

# If you're on an xterm, change the "address@hidden" and directory in
# titlebar
if test "$TERM" == "xterm" ; then
        PS1="\[\033]0;address@hidden:\w\007\]\@ \! address@hidden \w \n\$ "
else
        # prompt will show: time command address@hidden directory newline and $
        PS1="\@ \! address@hidden \w \n\$ "
fi
...
## Emacs: ansi-term + tramp integration
## in ansi-term, ssh to this remote computer, can do C-x C-f and find file in RE
MOTE working directory
## http://www.enigmacurry.com/2008/12/26/emacs-ansi-term-tricks/
#Emacs ansi-term directory tracking
# track directory, username, and cwd for remote logons
if [ $TERM = eterm-color ]; then
    function eterm-set-cwd {
        $@
        echo -e "\033AnSiTc" $(pwd)
    }

    # set hostname, user, and cwd
    function eterm-reset {
        echo -e "\033AnSiTu" $(whoami)
        echo -e "\033AnSiTc" $(pwd)
        echo -e "\033AnSiTh" $(hostname)
    }

    for temp in cd pushd popd; do
        alias $temp="eterm-set-cwd $temp"
    done
     # set hostname, user, and cwd now
    eterm-reset
fi

>> Vinh
>
> Best regards, Michael.
>
> PS: I'll start a trip tonight, being almost offline for the next 2
> weeks. If this proposal doesn't help, we must continue when I'll return.

Have a safe and fun trip.  Hope this gets to you before you leave.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]