unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* No User Shell Envir in Emacs via SSH
@ 2006-11-30 14:19 Kenneth Jacker
  2006-12-01  3:49 ` Glenn Morris
  2006-12-01  5:31 ` Eric Hanchrow
  0 siblings, 2 replies; 4+ messages in thread
From: Kenneth Jacker @ 2006-11-30 14:19 UTC (permalink / raw)


Sitting at home, I enter this into KDE's "Run Command..." (Kubuntu) to
"map" an X11/Emacs session running on my office machine onto my home
machine's monitor:

      +----------------------------+
      | Command:  ssh office emacs |
      +----------------------------+

The window appears on my home machine as expected and works fine.

The problem, however, is that my office machine's "bash environment"
isn't included/defined within Emacs. Apparently, the only
environmental variables defined are those from a system-wide Bash init
file (e.g. DISPLAY, HOME, LANG, MAIL, PATH, etc.).

Does anyone know what I need to do so that the "exported variables"
(i.e., environment) defined in my ".bashrc" are also present?

Thanks for your ideas!
-- 
Prof Kenneth H Jacker       khj@cs.appstate.edu
Computer Science Dept       www.cs.appstate.edu/~khj
Appalachian State Univ
Boone, NC  28608  USA        

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No User Shell Envir in Emacs via SSH
  2006-11-30 14:19 No User Shell Envir in Emacs via SSH Kenneth Jacker
@ 2006-12-01  3:49 ` Glenn Morris
  2006-12-01  5:31 ` Eric Hanchrow
  1 sibling, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2006-12-01  3:49 UTC (permalink / raw)


Kenneth Jacker wrote:

>       +----------------------------+
>       | Command:  ssh office emacs |
>       +----------------------------+
[...]
> The problem, however, is that my office machine's "bash environment"
> isn't included/defined within Emacs.
[...]
> Does anyone know what I need to do so that the "exported variables"
> (i.e., environment) defined in my ".bashrc" are also present?

That's a ssh/shell question rather than an Emacs question...

AFAIK, the "ssh <host> <command>" syntax starts a non-login shell on
the remote machine, so it should source ~/.bashrc but not
~/.bash_profile. Putting echo statements at the top of my ~/.bashrc
and ~/.bash_profile files and using 'ssh host true' confirms this.

Maybe you actually need ~/.bash_profile to be sourced, in which case
you can always just try:

ssh office 'source ~/.bash_profile; emacs'

Or maybe you can move statements from ~/.bash_profile to ~/.bashrc if
that makes sense.

Or maybe you have something in your ~/.bashrc that causes processing
to be aborted when sourced by ssh. Eg I have:

[ "$PS1" ] || return

part-way through mine, which means ssh only reads the top part of it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No User Shell Envir in Emacs via SSH
  2006-11-30 14:19 No User Shell Envir in Emacs via SSH Kenneth Jacker
  2006-12-01  3:49 ` Glenn Morris
@ 2006-12-01  5:31 ` Eric Hanchrow
  2006-12-01 18:31   ` Mathias Megyei
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Hanchrow @ 2006-12-01  5:31 UTC (permalink / raw)



    Sitting at home, I enter this into KDE's "Run Command..."
    (Kubuntu) to "map" an X11/Emacs session running on my office
    machine onto my home machine's monitor:

          +----------------------------+ | Command: ssh office emacs |
          +----------------------------+

    The window appears on my home machine as expected and works fine.

    The problem, however, is that my office machine's "bash
    environment" isn't included/defined within Emacs.  Apparently, the
    only environmental variables defined are those from a system-wide
    Bash init file (e.g.  DISPLAY, HOME, LANG, MAIL, PATH, etc.).

    Does anyone know what I need to do so that the "exported
    variables" (i.e., environment) defined in my ".bashrc" are also
    present?

I've never found a good solution for this.

What I'm using now is an astonishingly ugly Rube Goldberg type hack,
whereby my .bashrc runs a _perl_ program that creates files with
environment variable definitions -- one for the Bourne shell, and one
for emacs -- and then my .bash_profile sources the shell file, and I
have Emacs load the emacs file.

It works, but it makes the Baby Jesus cry.  Details upon request.

-- 
Software is largely a service industry operating under the
persistent but unfounded delusion that it is a manufacturing
industry.
        -- Eric Raymond

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No User Shell Envir in Emacs via SSH
  2006-12-01  5:31 ` Eric Hanchrow
@ 2006-12-01 18:31   ` Mathias Megyei
  0 siblings, 0 replies; 4+ messages in thread
From: Mathias Megyei @ 2006-12-01 18:31 UTC (permalink / raw)
  Cc: help-gnu-emacs

I have in my .bash_profile

LOGIN_SHELL=true
export LOGIN_SHELL

and in my .bashrc

if [ "x$LOGIN_SHELL" = "x" ]; then
    . .bash_profile
fi

Sa after ssh my .bash_profile is sorced only once.

Mathias

On Thu, 2006-11-30 at 21:31 -0800, Eric Hanchrow wrote:
>     Sitting at home, I enter this into KDE's "Run Command..."
>     (Kubuntu) to "map" an X11/Emacs session running on my office
>     machine onto my home machine's monitor:
> 
>           +----------------------------+ | Command: ssh office emacs |
>           +----------------------------+
> 
>     The window appears on my home machine as expected and works fine.
> 
>     The problem, however, is that my office machine's "bash
>     environment" isn't included/defined within Emacs.  Apparently, the
>     only environmental variables defined are those from a system-wide
>     Bash init file (e.g.  DISPLAY, HOME, LANG, MAIL, PATH, etc.).
> 
>     Does anyone know what I need to do so that the "exported
>     variables" (i.e., environment) defined in my ".bashrc" are also
>     present?
> 
> I've never found a good solution for this.
> 
> What I'm using now is an astonishingly ugly Rube Goldberg type hack,
> whereby my .bashrc runs a _perl_ program that creates files with
> environment variable definitions -- one for the Bourne shell, and one
> for emacs -- and then my .bash_profile sources the shell file, and I
> have Emacs load the emacs file.
> 
> It works, but it makes the Baby Jesus cry.  Details upon request.
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-01 18:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-30 14:19 No User Shell Envir in Emacs via SSH Kenneth Jacker
2006-12-01  3:49 ` Glenn Morris
2006-12-01  5:31 ` Eric Hanchrow
2006-12-01 18:31   ` Mathias Megyei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).