Re: How to execute a single command with a login environment?

unruh <unruh@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
On 2010-07-16, tinnews@xxxxxxxxxx <tinnews@xxxxxxxxxx> wrote:
unruh <unruh@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
On 2010-07-15, tinnews@xxxxxxxxxx <tinnews@xxxxxxxxxx> wrote:
I want to run a single command via ssh on a remote system:-

ssh <name of system> <command>

but I want my normal user environment that I'd get if I had executed
"ssh <name of system>" and then running the command from the bash
prompt. Apart from writing a wrapper script that sources .profile and
.bashrc (or whatever) is there a more straightforward way of doing

It is. But it is not done using a login environment since you do not
have a console to which the stuff could be sent. Maybe you should tell
us what you want to run, and what theproblem you are having is, rather
than asking how to impliment the solution you imagine would work.

I want to run mutt.

If I just do "ssh snake1 mutt" then I get errors about missing scripts
because the PATH isn't set up right. (The scripts are used by my
muttrc file).

ssh snake1 'export PATH=$PATH:/my/mut/scripts/dir:/my/other/dir; mutt'

I suspect that other things won't work due to environment expected by
mutt as well but I haven't got as far as checking that.

My suspicions were right, I now get no error message about missing
scripts but the connection just hangs - no output at all.

Chris Green