Discussion:
[iterm2-discuss] Managing shell integration with Linux and Mac (tcsh)
Matt Thompson
2018-10-15 13:34:25 UTC
Permalink
All,

This is an odd one. So, I'm trying to get the trick "change background
depending on host" and I managed to do it via my home MacBook Pro and on a
work MacBook Pro. I can log into a computational cluster and different
background! Huzzah!

But, I also (mainly) use a Linux workstation at work. Now I obviously don't
have shell integration on that box, but the cluster still had the "source
~/.iterm2_shell_integration.tcsh" in the .tcshrc. Unfortunately, that seems
to not be happy:

(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0 ]133;A(1000)
$ ]133;B

It's like some code the shell integration script sets is not something that
my Linux box (using MATE Terminal) likes at all.

So I'm a bit flummoxed. I'd like to use the shell integration, but I can't
source it on the remote I want to use it on automatically. Does anyone know
any SSH or other techniques that can allow a remote to know where the
incoming? I'd love to do "if from macbook, source" but I just cannot see
how.

Or, perhaps, do you think it's just an old tcsh on one of the sides that
can't handle something?

Thanks for any help,
Matt
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TJ Luoma
2018-10-15 15:29:18 UTC
Permalink
I don't know tcsh syntax, but on bash/zsh you could do something like
this to only source the file if you are using iTerm:

if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then

source ~/.iterm2_shell_integration.tcsh

fi

I think that would accomplish what you want.

--
TJ Luoma
TJ @ MacStories
Personal Website: luo.ma (aka RhymesWithDiploma.com)
All,
This is an odd one. So, I'm trying to get the trick "change background depending on host" and I managed to do it via my home MacBook Pro and on a work MacBook Pro. I can log into a computational cluster and different background! Huzzah!
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0 ]133;A(1000) $ ]133;B
It's like some code the shell integration script sets is not something that my Linux box (using MATE Terminal) likes at all.
So I'm a bit flummoxed. I'd like to use the shell integration, but I can't source it on the remote I want to use it on automatically. Does anyone know any SSH or other techniques that can allow a remote to know where the incoming? I'd love to do "if from macbook, source" but I just cannot see how.
Or, perhaps, do you think it's just an old tcsh on one of the sides that can't handle something?
Thanks for any help,
Matt
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matt Thompson
2018-10-15 16:13:33 UTC
Permalink
Hmm. Sadly it looks like TERM_PROGRAM is not an environment variable on the
remote server in either tcsh or bash. I have TERM=xterm-256color, but no
TERM_PROGRAM (perhaps iTerm2 itself sets it?).

I suppose I could just get used to running 'source
~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats
the purpose the nice automatic-ness because I'm lazy and I like how it's
magic as I ssh around :)
Post by TJ Luoma
I don't know tcsh syntax, but on bash/zsh you could do something like
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
All,
This is an odd one. So, I'm trying to get the trick "change background
depending on host" and I managed to do it via my home MacBook Pro and on a
work MacBook Pro. I can log into a computational cluster and different
background! Huzzah!
Post by Matt Thompson
But, I also (mainly) use a Linux workstation at work. Now I obviously
don't have shell integration on that box, but the cluster still had the
"source ~/.iterm2_shell_integration.tcsh" in the .tcshrc. Unfortunately,
Post by Matt Thompson
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C;
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0 ]133;A(1000) $
]133;B
Post by Matt Thompson
It's like some code the shell integration script sets is not something
that my Linux box (using MATE Terminal) likes at all.
Post by Matt Thompson
So I'm a bit flummoxed. I'd like to use the shell integration, but I
can't source it on the remote I want to use it on automatically. Does
anyone know any SSH or other techniques that can allow a remote to know
where the incoming? I'd love to do "if from macbook, source" but I just
cannot see how.
Post by Matt Thompson
Or, perhaps, do you think it's just an old tcsh on one of the sides that
can't handle something?
Post by Matt Thompson
Thanks for any help,
Matt
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna
Rampton
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Brown
2018-10-15 16:21:57 UTC
Permalink
If you are able to edit /etc/ssh/ssh_config on the local machine, and /etc/ssh/sshd_config on the remote machine, you can have ssh pass the environment across.



On the clients ssh_config, set:



                SendEnv TERM_PROGRAM



And on the remote’s sshd_config, set:



                AcceptEnv TERM_PROGRAM



If these are already present, add TERM_PROGRAM, separated by a space.



David



From: <iterm2-***@googlegroups.com> on behalf of Matt Thompson <***@gmail.com>
Reply-To: <iterm2-***@googlegroups.com>
Date: Monday, October 15, 2018 at 10:14 AM
To: <iterm2-***@googlegroups.com>
Subject: Re: [iterm2-discuss] Managing shell integration with Linux and Mac (tcsh)



Hmm. Sadly it looks like TERM_PROGRAM is not an environment variable on the remote server in either tcsh or bash. I have TERM=xterm-256color, but no TERM_PROGRAM (perhaps iTerm2 itself sets it?).



I suppose I could just get used to running 'source ~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats the purpose the nice automatic-ness because I'm lazy and I like how it's magic as I ssh around :)



On Mon, Oct 15, 2018 at 11:29 AM TJ Luoma <***@gmail.com> wrote:

I don't know tcsh syntax, but on bash/zsh you could do something like
this to only source the file if you are using iTerm:

if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then

source ~/.iterm2_shell_integration.tcsh

fi

I think that would accomplish what you want.

--
TJ Luoma
TJ @ MacStories
Personal Website: luo.ma (aka RhymesWithDiploma.com)
All,
This is an odd one. So, I'm trying to get the trick "change background depending on host" and I managed to do it via my home MacBook Pro and on a work MacBook Pro. I can log into a computational cluster and different background! Huzzah!
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0 ]133;A(1000) $ ]133;B
It's like some code the shell integration script sets is not something that my Linux box (using MATE Terminal) likes at all.
So I'm a bit flummoxed. I'd like to use the shell integration, but I can't source it on the remote I want to use it on automatically. Does anyone know any SSH or other techniques that can allow a remote to know where the incoming? I'd love to do "if from macbook, source" but I just cannot see how.
Or, perhaps, do you think it's just an old tcsh on one of the sides that can't handle something?
Thanks for any help,
Matt
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson

“The fact is, this is about us identifying what we do best and

finding more ways of doing less of it better” -- Director of Better Anna Rampton
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matt Thompson
2018-10-15 16:27:52 UTC
Permalink
David,

Sadly not. This is a supercomputing cluster that I need two-factor
authentication to just log into, and I'm not an admin. Of course, I can
easily alter my .ssh/config, so SendEnv is easy, but it's not accepted on
the other side.

I'm guessing "Matt wants automatic colored terminals" won't exactly fly as
a reason to change /etc/sshd_config :D
Post by David Brown
If you are able to edit /etc/ssh/ssh_config on the local machine, and
/etc/ssh/sshd_config on the remote machine, you can have ssh pass the
environment across.
SendEnv TERM_PROGRAM
AcceptEnv TERM_PROGRAM
If these are already present, add TERM_PROGRAM, separated by a space.
David
*Date: *Monday, October 15, 2018 at 10:14 AM
*Subject: *Re: [iterm2-discuss] Managing shell integration with Linux and
Mac (tcsh)
Hmm. Sadly it looks like TERM_PROGRAM is not an environment variable on
the remote server in either tcsh or bash. I have TERM=xterm-256color, but
no TERM_PROGRAM (perhaps iTerm2 itself sets it?).
I suppose I could just get used to running 'source
~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats
the purpose the nice automatic-ness because I'm lazy and I like how it's
magic as I ssh around :)
I don't know tcsh syntax, but on bash/zsh you could do something like
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
All,
This is an odd one. So, I'm trying to get the trick "change background
depending on host" and I managed to do it via my home MacBook Pro and on a
work MacBook Pro. I can log into a computational cluster and different
background! Huzzah!
Post by Matt Thompson
But, I also (mainly) use a Linux workstation at work. Now I obviously
don't have shell integration on that box, but the cluster still had the
"source ~/.iterm2_shell_integration.tcsh" in the .tcshrc. Unfortunately,
Post by Matt Thompson
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C;
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0 ]133;A(1000) $
]133;B
Post by Matt Thompson
It's like some code the shell integration script sets is not something
that my Linux box (using MATE Terminal) likes at all.
Post by Matt Thompson
So I'm a bit flummoxed. I'd like to use the shell integration, but I
can't source it on the remote I want to use it on automatically. Does
anyone know any SSH or other techniques that can allow a remote to know
where the incoming? I'd love to do "if from macbook, source" but I just
cannot see how.
Post by Matt Thompson
Or, perhaps, do you think it's just an old tcsh on one of the sides that
can't handle something?
Post by Matt Thompson
Thanks for any help,
Matt
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna Rampton
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna
Rampton
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TJ Luoma
2018-10-15 17:00:30 UTC
Permalink
I think the only option left is a real hail-Mary: Do you usually
connect to the server from the same place?

If you can isolate the IP block that you use, you might be able to
check "$SSH_CLIENT" which will start with your remote IP address, and
do different things based on different IP addresses. (I'm assuming
tcsh has something similar to 'case / esac' in bash)

Checkout `env` and see if there are any other identifying options.

TjL

--
TJ Luoma
TJ @ MacStories
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
David,
Sadly not. This is a supercomputing cluster that I need two-factor authentication to just log into, and I'm not an admin. Of course, I can easily alter my .ssh/config, so SendEnv is easy, but it's not accepted on the other side.
I'm guessing "Matt wants automatic colored terminals" won't exactly fly as a reason to change /etc/sshd_config :D
Post by David Brown
If you are able to edit /etc/ssh/ssh_config on the local machine, and /etc/ssh/sshd_config on the remote machine, you can have ssh pass the environment across.
SendEnv TERM_PROGRAM
AcceptEnv TERM_PROGRAM
If these are already present, add TERM_PROGRAM, separated by a space.
David
Date: Monday, October 15, 2018 at 10:14 AM
Subject: Re: [iterm2-discuss] Managing shell integration with Linux and Mac (tcsh)
Hmm. Sadly it looks like TERM_PROGRAM is not an environment variable on the remote server in either tcsh or bash. I have TERM=xterm-256color, but no TERM_PROGRAM (perhaps iTerm2 itself sets it?).
I suppose I could just get used to running 'source ~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats the purpose the nice automatic-ness because I'm lazy and I like how it's magic as I ssh around :)
I don't know tcsh syntax, but on bash/zsh you could do something like
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
All,
This is an odd one. So, I'm trying to get the trick "change background depending on host" and I managed to do it via my home MacBook Pro and on a work MacBook Pro. I can log into a computational cluster and different background! Huzzah!
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0 ]133;A(1000) $ ]133;B
It's like some code the shell integration script sets is not something that my Linux box (using MATE Terminal) likes at all.
So I'm a bit flummoxed. I'd like to use the shell integration, but I can't source it on the remote I want to use it on automatically. Does anyone know any SSH or other techniques that can allow a remote to know where the incoming? I'd love to do "if from macbook, source" but I just cannot see how.
Or, perhaps, do you think it's just an old tcsh on one of the sides that can't handle something?
Thanks for any help,
Matt
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna Rampton
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna Rampton
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
George Nachman
2018-10-15 17:04:18 UTC
Permalink
There’s one option that hasn’t been discussed. OpenSSH will pass through
all environment variables that begin with “LC_”. The nightly build now sets
LC_TERMINAL and LC_TERMINAL_VERSION. 3.2does not but you can modify your
bashrc to do that for you, of course.
Post by TJ Luoma
I think the only option left is a real hail-Mary: Do you usually
connect to the server from the same place?
If you can isolate the IP block that you use, you might be able to
check "$SSH_CLIENT" which will start with your remote IP address, and
do different things based on different IP addresses. (I'm assuming
tcsh has something similar to 'case / esac' in bash)
Checkout `env` and see if there are any other identifying options.
TjL
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
David,
Sadly not. This is a supercomputing cluster that I need two-factor
authentication to just log into, and I'm not an admin. Of course, I can
easily alter my .ssh/config, so SendEnv is easy, but it's not accepted on
the other side.
Post by Matt Thompson
I'm guessing "Matt wants automatic colored terminals" won't exactly fly
as a reason to change /etc/sshd_config :D
Post by Matt Thompson
Post by David Brown
If you are able to edit /etc/ssh/ssh_config on the local machine, and
/etc/ssh/sshd_config on the remote machine, you can have ssh pass the
environment across.
Post by Matt Thompson
Post by David Brown
SendEnv TERM_PROGRAM
AcceptEnv TERM_PROGRAM
If these are already present, add TERM_PROGRAM, separated by a space.
David
Date: Monday, October 15, 2018 at 10:14 AM
Subject: Re: [iterm2-discuss] Managing shell integration with Linux and
Mac (tcsh)
Post by Matt Thompson
Post by David Brown
Hmm. Sadly it looks like TERM_PROGRAM is not an environment variable on
the remote server in either tcsh or bash. I have TERM=xterm-256color, but
no TERM_PROGRAM (perhaps iTerm2 itself sets it?).
Post by Matt Thompson
Post by David Brown
I suppose I could just get used to running 'source
~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats
the purpose the nice automatic-ness because I'm lazy and I like how it's
magic as I ssh around :)
Post by Matt Thompson
Post by David Brown
I don't know tcsh syntax, but on bash/zsh you could do something like
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
All,
This is an odd one. So, I'm trying to get the trick "change
background depending on host" and I managed to do it via my home MacBook
Pro and on a work MacBook Pro. I can log into a computational cluster and
different background! Huzzah!
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
But, I also (mainly) use a Linux workstation at work. Now I obviously
don't have shell integration on that box, but the cluster still had the
"source ~/.iterm2_shell_integration.tcsh" in the .tcshrc. Unfortunately,
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C;
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0
]133;A(1000) $ ]133;B
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
It's like some code the shell integration script sets is not
something that my Linux box (using MATE Terminal) likes at all.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
So I'm a bit flummoxed. I'd like to use the shell integration, but I
can't source it on the remote I want to use it on automatically. Does
anyone know any SSH or other techniques that can allow a remote to know
where the incoming? I'd love to do "if from macbook, source" but I just
cannot see how.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Or, perhaps, do you think it's just an old tcsh on one of the sides
that can't handle something?
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Thanks for any help,
Matt
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better
Anna Rampton
Post by Matt Thompson
Post by David Brown
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better
Anna Rampton
Post by Matt Thompson
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matt Thompson
2018-10-15 17:10:41 UTC
Permalink
George,

It doesn't seem to do this for me. I'm running stable on my Mac, but I
tried exporting "LC_ITERM2=1" in the environment and then ssh'ing. But on
the other end, no LC_ITERM2 in my environment.
Post by George Nachman
There’s one option that hasn’t been discussed. OpenSSH will pass through
all environment variables that begin with “LC_”. The nightly build now sets
LC_TERMINAL and LC_TERMINAL_VERSION. 3.2does not but you can modify your
bashrc to do that for you, of course.
Post by TJ Luoma
I think the only option left is a real hail-Mary: Do you usually
connect to the server from the same place?
If you can isolate the IP block that you use, you might be able to
check "$SSH_CLIENT" which will start with your remote IP address, and
do different things based on different IP addresses. (I'm assuming
tcsh has something similar to 'case / esac' in bash)
Checkout `env` and see if there are any other identifying options.
TjL
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
David,
Sadly not. This is a supercomputing cluster that I need two-factor
authentication to just log into, and I'm not an admin. Of course, I can
easily alter my .ssh/config, so SendEnv is easy, but it's not accepted on
the other side.
Post by Matt Thompson
I'm guessing "Matt wants automatic colored terminals" won't exactly fly
as a reason to change /etc/sshd_config :D
Post by Matt Thompson
Post by David Brown
If you are able to edit /etc/ssh/ssh_config on the local machine, and
/etc/ssh/sshd_config on the remote machine, you can have ssh pass the
environment across.
Post by Matt Thompson
Post by David Brown
SendEnv TERM_PROGRAM
AcceptEnv TERM_PROGRAM
If these are already present, add TERM_PROGRAM, separated by a space.
David
Date: Monday, October 15, 2018 at 10:14 AM
Subject: Re: [iterm2-discuss] Managing shell integration with Linux
and Mac (tcsh)
Post by Matt Thompson
Post by David Brown
Hmm. Sadly it looks like TERM_PROGRAM is not an environment variable
on the remote server in either tcsh or bash. I have TERM=xterm-256color,
but no TERM_PROGRAM (perhaps iTerm2 itself sets it?).
Post by Matt Thompson
Post by David Brown
I suppose I could just get used to running 'source
~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats
the purpose the nice automatic-ness because I'm lazy and I like how it's
magic as I ssh around :)
Post by Matt Thompson
Post by David Brown
I don't know tcsh syntax, but on bash/zsh you could do something like
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
All,
This is an odd one. So, I'm trying to get the trick "change
background depending on host" and I managed to do it via my home MacBook
Pro and on a work MacBook Pro. I can log into a computational cluster and
different background! Huzzah!
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
But, I also (mainly) use a Linux workstation at work. Now I
obviously don't have shell integration on that box, but the cluster still
had the "source ~/.iterm2_shell_integration.tcsh" in the .tcshrc.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C;
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0
]133;A(1000) $ ]133;B
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
It's like some code the shell integration script sets is not
something that my Linux box (using MATE Terminal) likes at all.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
So I'm a bit flummoxed. I'd like to use the shell integration, but I
can't source it on the remote I want to use it on automatically. Does
anyone know any SSH or other techniques that can allow a remote to know
where the incoming? I'd love to do "if from macbook, source" but I just
cannot see how.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Or, perhaps, do you think it's just an old tcsh on one of the sides
that can't handle something?
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Thanks for any help,
Matt
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better
Anna Rampton
Post by Matt Thompson
Post by David Brown
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better
Anna Rampton
Post by Matt Thompson
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna
Rampton
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
George Nachman
2018-10-15 17:18:32 UTC
Permalink
What ssh client and version are you using?
Post by Matt Thompson
George,
It doesn't seem to do this for me. I'm running stable on my Mac, but I
tried exporting "LC_ITERM2=1" in the environment and then ssh'ing. But on
the other end, no LC_ITERM2 in my environment.
Post by George Nachman
There’s one option that hasn’t been discussed. OpenSSH will pass through
all environment variables that begin with “LC_”. The nightly build now sets
LC_TERMINAL and LC_TERMINAL_VERSION. 3.2does not but you can modify your
bashrc to do that for you, of course.
Post by TJ Luoma
I think the only option left is a real hail-Mary: Do you usually
connect to the server from the same place?
If you can isolate the IP block that you use, you might be able to
check "$SSH_CLIENT" which will start with your remote IP address, and
do different things based on different IP addresses. (I'm assuming
tcsh has something similar to 'case / esac' in bash)
Checkout `env` and see if there are any other identifying options.
TjL
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
David,
Sadly not. This is a supercomputing cluster that I need two-factor
authentication to just log into, and I'm not an admin. Of course, I can
easily alter my .ssh/config, so SendEnv is easy, but it's not accepted on
the other side.
Post by Matt Thompson
I'm guessing "Matt wants automatic colored terminals" won't exactly
fly as a reason to change /etc/sshd_config :D
Post by Matt Thompson
Post by David Brown
If you are able to edit /etc/ssh/ssh_config on the local machine, and
/etc/ssh/sshd_config on the remote machine, you can have ssh pass the
environment across.
Post by Matt Thompson
Post by David Brown
SendEnv TERM_PROGRAM
AcceptEnv TERM_PROGRAM
If these are already present, add TERM_PROGRAM, separated by a space.
David
Date: Monday, October 15, 2018 at 10:14 AM
Subject: Re: [iterm2-discuss] Managing shell integration with Linux
and Mac (tcsh)
Post by Matt Thompson
Post by David Brown
Hmm. Sadly it looks like TERM_PROGRAM is not an environment variable
on the remote server in either tcsh or bash. I have TERM=xterm-256color,
but no TERM_PROGRAM (perhaps iTerm2 itself sets it?).
Post by Matt Thompson
Post by David Brown
I suppose I could just get used to running 'source
~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats
the purpose the nice automatic-ness because I'm lazy and I like how it's
magic as I ssh around :)
Post by Matt Thompson
Post by David Brown
I don't know tcsh syntax, but on bash/zsh you could do something like
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
All,
This is an odd one. So, I'm trying to get the trick "change
background depending on host" and I managed to do it via my home MacBook
Pro and on a work MacBook Pro. I can log into a computational cluster and
different background! Huzzah!
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
But, I also (mainly) use a Linux workstation at work. Now I
obviously don't have shell integration on that box, but the cluster still
had the "source ~/.iterm2_shell_integration.tcsh" in the .tcshrc.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C;
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0
]133;A(1000) $ ]133;B
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
It's like some code the shell integration script sets is not
something that my Linux box (using MATE Terminal) likes at all.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
So I'm a bit flummoxed. I'd like to use the shell integration, but
I can't source it on the remote I want to use it on automatically. Does
anyone know any SSH or other techniques that can allow a remote to know
where the incoming? I'd love to do "if from macbook, source" but I just
cannot see how.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Or, perhaps, do you think it's just an old tcsh on one of the sides
that can't handle something?
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Thanks for any help,
Matt
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
Post by David Brown
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better
Anna Rampton
Post by Matt Thompson
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna Rampton
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matt Thompson
2018-10-15 17:33:34 UTC
Permalink
Looks like OpenSSH 7.4p1 on my desktop. Older on the cluster because
cluster distros tend to stability rather than new functions.

FYI: I tried using bash on the other end as well and the terminal doesn't
like sourcing the bash shell integration either. I also tried using GNOME
Terminal instead of MATE Terminal, nope. Even tried Guake but it *really*
didn't like it, though I might have an old guake or bad setup there. I
don't often run it.
Post by George Nachman
What ssh client and version are you using?
Post by Matt Thompson
George,
It doesn't seem to do this for me. I'm running stable on my Mac, but I
tried exporting "LC_ITERM2=1" in the environment and then ssh'ing. But on
the other end, no LC_ITERM2 in my environment.
Post by George Nachman
There’s one option that hasn’t been discussed. OpenSSH will pass through
all environment variables that begin with “LC_”. The nightly build now sets
LC_TERMINAL and LC_TERMINAL_VERSION. 3.2does not but you can modify your
bashrc to do that for you, of course.
Post by TJ Luoma
I think the only option left is a real hail-Mary: Do you usually
connect to the server from the same place?
If you can isolate the IP block that you use, you might be able to
check "$SSH_CLIENT" which will start with your remote IP address, and
do different things based on different IP addresses. (I'm assuming
tcsh has something similar to 'case / esac' in bash)
Checkout `env` and see if there are any other identifying options.
TjL
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
David,
Sadly not. This is a supercomputing cluster that I need two-factor
authentication to just log into, and I'm not an admin. Of course, I can
easily alter my .ssh/config, so SendEnv is easy, but it's not accepted on
the other side.
Post by Matt Thompson
I'm guessing "Matt wants automatic colored terminals" won't exactly
fly as a reason to change /etc/sshd_config :D
Post by Matt Thompson
Post by David Brown
If you are able to edit /etc/ssh/ssh_config on the local machine,
and /etc/ssh/sshd_config on the remote machine, you can have ssh pass the
environment across.
Post by Matt Thompson
Post by David Brown
SendEnv TERM_PROGRAM
AcceptEnv TERM_PROGRAM
If these are already present, add TERM_PROGRAM, separated by a space.
David
Date: Monday, October 15, 2018 at 10:14 AM
Subject: Re: [iterm2-discuss] Managing shell integration with Linux
and Mac (tcsh)
Post by Matt Thompson
Post by David Brown
Hmm. Sadly it looks like TERM_PROGRAM is not an environment variable
on the remote server in either tcsh or bash. I have TERM=xterm-256color,
but no TERM_PROGRAM (perhaps iTerm2 itself sets it?).
Post by Matt Thompson
Post by David Brown
I suppose I could just get used to running 'source
~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats
the purpose the nice automatic-ness because I'm lazy and I like how it's
magic as I ssh around :)
Post by Matt Thompson
Post by David Brown
I don't know tcsh syntax, but on bash/zsh you could do something like
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
All,
This is an odd one. So, I'm trying to get the trick "change
background depending on host" and I managed to do it via my home MacBook
Pro and on a work MacBook Pro. I can log into a computational cluster and
different background! Huzzah!
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
But, I also (mainly) use a Linux workstation at work. Now I
obviously don't have shell integration on that box, but the cluster still
had the "source ~/.iterm2_shell_integration.tcsh" in the .tcshrc.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C;
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0
]133;A(1000) $ ]133;B
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
It's like some code the shell integration script sets is not
something that my Linux box (using MATE Terminal) likes at all.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
So I'm a bit flummoxed. I'd like to use the shell integration, but
I can't source it on the remote I want to use it on automatically. Does
anyone know any SSH or other techniques that can allow a remote to know
where the incoming? I'd love to do "if from macbook, source" but I just
cannot see how.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Or, perhaps, do you think it's just an old tcsh on one of the
sides that can't handle something?
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Thanks for any help,
Matt
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
Post by David Brown
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna Rampton
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna
Rampton
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
George Nachman
2018-10-15 18:05:19 UTC
Permalink
Server might be blocking this (see
https://stackoverflow.com/questions/29609371/how-do-not-pass-locale-through-ssh
for how that would be done)

The last option is the isiterm2 script:

https://github.com/gnachman/iTerm2/blob/master/tests/isiterm2.sh

It exits successfully only if the terminal is iTerm2
Post by Matt Thompson
Looks like OpenSSH 7.4p1 on my desktop. Older on the cluster because
cluster distros tend to stability rather than new functions.
FYI: I tried using bash on the other end as well and the terminal doesn't
like sourcing the bash shell integration either. I also tried using GNOME
Terminal instead of MATE Terminal, nope. Even tried Guake but it *really*
didn't like it, though I might have an old guake or bad setup there. I
don't often run it.
Post by George Nachman
What ssh client and version are you using?
Post by Matt Thompson
George,
It doesn't seem to do this for me. I'm running stable on my Mac, but I
tried exporting "LC_ITERM2=1" in the environment and then ssh'ing. But on
the other end, no LC_ITERM2 in my environment.
Post by George Nachman
There’s one option that hasn’t been discussed. OpenSSH will pass
through all environment variables that begin with “LC_”. The nightly build
now sets LC_TERMINAL and LC_TERMINAL_VERSION. 3.2does not but you can
modify your bashrc to do that for you, of course.
Post by TJ Luoma
I think the only option left is a real hail-Mary: Do you usually
connect to the server from the same place?
If you can isolate the IP block that you use, you might be able to
check "$SSH_CLIENT" which will start with your remote IP address, and
do different things based on different IP addresses. (I'm assuming
tcsh has something similar to 'case / esac' in bash)
Checkout `env` and see if there are any other identifying options.
TjL
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
David,
Sadly not. This is a supercomputing cluster that I need two-factor
authentication to just log into, and I'm not an admin. Of course, I can
easily alter my .ssh/config, so SendEnv is easy, but it's not accepted on
the other side.
Post by Matt Thompson
I'm guessing "Matt wants automatic colored terminals" won't exactly
fly as a reason to change /etc/sshd_config :D
Post by Matt Thompson
Post by David Brown
If you are able to edit /etc/ssh/ssh_config on the local machine,
and /etc/ssh/sshd_config on the remote machine, you can have ssh pass the
environment across.
Post by Matt Thompson
Post by David Brown
SendEnv TERM_PROGRAM
AcceptEnv TERM_PROGRAM
If these are already present, add TERM_PROGRAM, separated by a
space.
Post by Matt Thompson
Post by David Brown
David
Date: Monday, October 15, 2018 at 10:14 AM
Subject: Re: [iterm2-discuss] Managing shell integration with Linux
and Mac (tcsh)
Post by Matt Thompson
Post by David Brown
Hmm. Sadly it looks like TERM_PROGRAM is not an environment
variable on the remote server in either tcsh or bash. I have
TERM=xterm-256color, but no TERM_PROGRAM (perhaps iTerm2 itself sets it?).
Post by Matt Thompson
Post by David Brown
I suppose I could just get used to running 'source
~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats
the purpose the nice automatic-ness because I'm lazy and I like how it's
magic as I ssh around :)
Post by Matt Thompson
Post by David Brown
I don't know tcsh syntax, but on bash/zsh you could do something
like
Post by Matt Thompson
Post by David Brown
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
All,
This is an odd one. So, I'm trying to get the trick "change
background depending on host" and I managed to do it via my home MacBook
Pro and on a work MacBook Pro. I can log into a computational cluster and
different background! Huzzah!
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
But, I also (mainly) use a Linux workstation at work. Now I
obviously don't have shell integration on that box, but the cluster still
had the "source ~/.iterm2_shell_integration.tcsh" in the .tcshrc.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C;
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0
]133;A(1000) $ ]133;B
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
It's like some code the shell integration script sets is not
something that my Linux box (using MATE Terminal) likes at all.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
So I'm a bit flummoxed. I'd like to use the shell integration,
but I can't source it on the remote I want to use it on automatically. Does
anyone know any SSH or other techniques that can allow a remote to know
where the incoming? I'd love to do "if from macbook, source" but I just
cannot see how.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Or, perhaps, do you think it's just an old tcsh on one of the
sides that can't handle something?
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Thanks for any help,
Matt
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
Post by David Brown
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better
Anna Rampton
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna Rampton
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matt Thompson
2018-10-15 19:30:51 UTC
Permalink
Wow. That script powerfully locks up on our cluster!

If I run (with echo on):

+ '[' '!' -t 0 ']'
+ '[' '!' -t 1 ']'
++ stty -g
+
saved_stty=2d00:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
+ trap ctrl_c INT
+ stty -echo -icanon raw
+ MIN_VERSION=2.9.20160304
+ '[' 0 -eq 1 ']'
+ echo -n '[1337n'
[1337n+ echo
-n '[5n'

[5n++ read_dsr

++ dsr=

+++ read_bytes 2

+++ numbytes=2

+++ dd bs=1 count=2


Terminated

Where "Terminated" is from my killing the PID on a separate terminal.
Post by George Nachman
Server might be blocking this (see
https://stackoverflow.com/questions/29609371/how-do-not-pass-locale-through-ssh
for how that would be done)
https://github.com/gnachman/iTerm2/blob/master/tests/isiterm2.sh
It exits successfully only if the terminal is iTerm2
Post by Matt Thompson
Looks like OpenSSH 7.4p1 on my desktop. Older on the cluster because
cluster distros tend to stability rather than new functions.
FYI: I tried using bash on the other end as well and the terminal doesn't
like sourcing the bash shell integration either. I also tried using GNOME
Terminal instead of MATE Terminal, nope. Even tried Guake but it *really*
didn't like it, though I might have an old guake or bad setup there. I
don't often run it.
Post by George Nachman
What ssh client and version are you using?
Post by Matt Thompson
George,
It doesn't seem to do this for me. I'm running stable on my Mac, but I
tried exporting "LC_ITERM2=1" in the environment and then ssh'ing. But on
the other end, no LC_ITERM2 in my environment.
Post by George Nachman
There’s one option that hasn’t been discussed. OpenSSH will pass
through all environment variables that begin with “LC_”. The nightly build
now sets LC_TERMINAL and LC_TERMINAL_VERSION. 3.2does not but you can
modify your bashrc to do that for you, of course.
Post by TJ Luoma
I think the only option left is a real hail-Mary: Do you usually
connect to the server from the same place?
If you can isolate the IP block that you use, you might be able to
check "$SSH_CLIENT" which will start with your remote IP address, and
do different things based on different IP addresses. (I'm assuming
tcsh has something similar to 'case / esac' in bash)
Checkout `env` and see if there are any other identifying options.
TjL
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
David,
Sadly not. This is a supercomputing cluster that I need two-factor
authentication to just log into, and I'm not an admin. Of course, I can
easily alter my .ssh/config, so SendEnv is easy, but it's not accepted on
the other side.
Post by Matt Thompson
I'm guessing "Matt wants automatic colored terminals" won't exactly
fly as a reason to change /etc/sshd_config :D
Post by Matt Thompson
Post by David Brown
If you are able to edit /etc/ssh/ssh_config on the local machine,
and /etc/ssh/sshd_config on the remote machine, you can have ssh pass the
environment across.
Post by Matt Thompson
Post by David Brown
SendEnv TERM_PROGRAM
AcceptEnv TERM_PROGRAM
If these are already present, add TERM_PROGRAM, separated by a
space.
Post by Matt Thompson
Post by David Brown
David
Date: Monday, October 15, 2018 at 10:14 AM
Subject: Re: [iterm2-discuss] Managing shell integration with
Linux and Mac (tcsh)
Post by Matt Thompson
Post by David Brown
Hmm. Sadly it looks like TERM_PROGRAM is not an environment
variable on the remote server in either tcsh or bash. I have
TERM=xterm-256color, but no TERM_PROGRAM (perhaps iTerm2 itself sets it?).
Post by Matt Thompson
Post by David Brown
I suppose I could just get used to running 'source
~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats
the purpose the nice automatic-ness because I'm lazy and I like how it's
magic as I ssh around :)
Post by Matt Thompson
Post by David Brown
I don't know tcsh syntax, but on bash/zsh you could do something
like
Post by Matt Thompson
Post by David Brown
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
All,
This is an odd one. So, I'm trying to get the trick "change
background depending on host" and I managed to do it via my home MacBook
Pro and on a work MacBook Pro. I can log into a computational cluster and
different background! Huzzah!
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
But, I also (mainly) use a Linux workstation at work. Now I
obviously don't have shell integration on that box, but the cluster still
had the "source ~/.iterm2_shell_integration.tcsh" in the .tcshrc.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C;
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0
]133;A(1000) $ ]133;B
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
It's like some code the shell integration script sets is not
something that my Linux box (using MATE Terminal) likes at all.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
So I'm a bit flummoxed. I'd like to use the shell integration,
but I can't source it on the remote I want to use it on automatically. Does
anyone know any SSH or other techniques that can allow a remote to know
where the incoming? I'd love to do "if from macbook, source" but I just
cannot see how.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Or, perhaps, do you think it's just an old tcsh on one of the
sides that can't handle something?
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Thanks for any help,
Matt
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
Post by David Brown
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better
Anna Rampton
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna Rampton
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna
Rampton
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
George Nachman
2018-10-16 05:45:05 UTC
Permalink
That's very odd. I take it that no amount of banging on the keyboard got it
to budge? I wonder if there's something about TTYs on this system that are
different than what I've tested on. What OS is it? If you do this:

stty -echo -icanon raw ; dd bs=1 count=2

And then you do 2 keystrokes, does it finish running dd or is it hung?
Post by Matt Thompson
Wow. That script powerfully locks up on our cluster!
+ '[' '!' -t 0 ']'
+ '[' '!' -t 1 ']'
++ stty -g
+
saved_stty=2d00:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
+ trap ctrl_c INT
+ stty -echo -icanon raw
+ MIN_VERSION=2.9.20160304
+ '[' 0 -eq 1 ']'
+ echo -n '[1337n'
[1337n+ echo
-n '[5n'
[5n++ read_dsr
++ dsr=
+++ read_bytes 2
+++ numbytes=2
+++ dd bs=1 count=2
Terminated
Where "Terminated" is from my killing the PID on a separate terminal.
Post by George Nachman
Server might be blocking this (see
https://stackoverflow.com/questions/29609371/how-do-not-pass-locale-through-ssh
for how that would be done)
https://github.com/gnachman/iTerm2/blob/master/tests/isiterm2.sh
It exits successfully only if the terminal is iTerm2
Post by Matt Thompson
Looks like OpenSSH 7.4p1 on my desktop. Older on the cluster because
cluster distros tend to stability rather than new functions.
FYI: I tried using bash on the other end as well and the terminal
doesn't like sourcing the bash shell integration either. I also tried using
GNOME Terminal instead of MATE Terminal, nope. Even tried Guake but it
*really* didn't like it, though I might have an old guake or bad setup
there. I don't often run it.
Post by George Nachman
What ssh client and version are you using?
Post by Matt Thompson
George,
It doesn't seem to do this for me. I'm running stable on my Mac, but I
tried exporting "LC_ITERM2=1" in the environment and then ssh'ing. But on
the other end, no LC_ITERM2 in my environment.
Post by George Nachman
There’s one option that hasn’t been discussed. OpenSSH will pass
through all environment variables that begin with “LC_”. The nightly build
now sets LC_TERMINAL and LC_TERMINAL_VERSION. 3.2does not but you can
modify your bashrc to do that for you, of course.
Post by TJ Luoma
I think the only option left is a real hail-Mary: Do you usually
connect to the server from the same place?
If you can isolate the IP block that you use, you might be able to
check "$SSH_CLIENT" which will start with your remote IP address, and
do different things based on different IP addresses. (I'm assuming
tcsh has something similar to 'case / esac' in bash)
Checkout `env` and see if there are any other identifying options.
TjL
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
David,
Sadly not. This is a supercomputing cluster that I need two-factor
authentication to just log into, and I'm not an admin. Of course, I can
easily alter my .ssh/config, so SendEnv is easy, but it's not accepted on
the other side.
Post by Matt Thompson
I'm guessing "Matt wants automatic colored terminals" won't
exactly fly as a reason to change /etc/sshd_config :D
Post by Matt Thompson
Post by David Brown
If you are able to edit /etc/ssh/ssh_config on the local machine,
and /etc/ssh/sshd_config on the remote machine, you can have ssh pass the
environment across.
Post by Matt Thompson
Post by David Brown
SendEnv TERM_PROGRAM
AcceptEnv TERM_PROGRAM
If these are already present, add TERM_PROGRAM, separated by a
space.
Post by Matt Thompson
Post by David Brown
David
Date: Monday, October 15, 2018 at 10:14 AM
Subject: Re: [iterm2-discuss] Managing shell integration with
Linux and Mac (tcsh)
Post by Matt Thompson
Post by David Brown
Hmm. Sadly it looks like TERM_PROGRAM is not an environment
variable on the remote server in either tcsh or bash. I have
TERM=xterm-256color, but no TERM_PROGRAM (perhaps iTerm2 itself sets it?).
Post by Matt Thompson
Post by David Brown
I suppose I could just get used to running 'source
~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats
the purpose the nice automatic-ness because I'm lazy and I like how it's
magic as I ssh around :)
Post by Matt Thompson
Post by David Brown
I don't know tcsh syntax, but on bash/zsh you could do something
like
Post by Matt Thompson
Post by David Brown
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
All,
This is an odd one. So, I'm trying to get the trick "change
background depending on host" and I managed to do it via my home MacBook
Pro and on a work MacBook Pro. I can log into a computational cluster and
different background! Huzzah!
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
But, I also (mainly) use a Linux workstation at work. Now I
obviously don't have shell integration on that box, but the cluster still
had the "source ~/.iterm2_shell_integration.tcsh" in the .tcshrc.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C;
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0
]133;A(1000) $ ]133;B
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
It's like some code the shell integration script sets is not
something that my Linux box (using MATE Terminal) likes at all.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
So I'm a bit flummoxed. I'd like to use the shell integration,
but I can't source it on the remote I want to use it on automatically. Does
anyone know any SSH or other techniques that can allow a remote to know
where the incoming? I'd love to do "if from macbook, source" but I just
cannot see how.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Or, perhaps, do you think it's just an old tcsh on one of the
sides that can't handle something?
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Thanks for any help,
Matt
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
Post by David Brown
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better
Anna Rampton
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better
Anna Rampton
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna Rampton
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matt Thompson
2018-10-16 19:04:11 UTC
Permalink
That works! On both sides.
Post by George Nachman
That's very odd. I take it that no amount of banging on the keyboard got
it to budge? I wonder if there's something about TTYs on this system that
stty -echo -icanon raw ; dd bs=1 count=2
And then you do 2 keystrokes, does it finish running dd or is it hung?
Post by Matt Thompson
Wow. That script powerfully locks up on our cluster!
+ '[' '!' -t 0 ']'
+ '[' '!' -t 1 ']'
++ stty -g
+
saved_stty=2d00:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
+ trap ctrl_c INT
+ stty -echo -icanon raw
+ MIN_VERSION=2.9.20160304
+ '[' 0 -eq 1 ']'
+ echo -n '[1337n'
[1337n+ echo
-n '[5n'
[5n++ read_dsr
++ dsr=
+++ read_bytes 2
+++ numbytes=2
+++ dd bs=1 count=2
Terminated
Where "Terminated" is from my killing the PID on a separate terminal.
Post by George Nachman
Server might be blocking this (see
https://stackoverflow.com/questions/29609371/how-do-not-pass-locale-through-ssh
for how that would be done)
https://github.com/gnachman/iTerm2/blob/master/tests/isiterm2.sh
It exits successfully only if the terminal is iTerm2
Post by Matt Thompson
Looks like OpenSSH 7.4p1 on my desktop. Older on the cluster because
cluster distros tend to stability rather than new functions.
FYI: I tried using bash on the other end as well and the terminal
doesn't like sourcing the bash shell integration either. I also tried using
GNOME Terminal instead of MATE Terminal, nope. Even tried Guake but it
*really* didn't like it, though I might have an old guake or bad setup
there. I don't often run it.
Post by George Nachman
What ssh client and version are you using?
Post by Matt Thompson
George,
It doesn't seem to do this for me. I'm running stable on my Mac, but
I tried exporting "LC_ITERM2=1" in the environment and then ssh'ing. But on
the other end, no LC_ITERM2 in my environment.
Post by George Nachman
There’s one option that hasn’t been discussed. OpenSSH will pass
through all environment variables that begin with “LC_”. The nightly build
now sets LC_TERMINAL and LC_TERMINAL_VERSION. 3.2does not but you can
modify your bashrc to do that for you, of course.
Post by TJ Luoma
I think the only option left is a real hail-Mary: Do you usually
connect to the server from the same place?
If you can isolate the IP block that you use, you might be able to
check "$SSH_CLIENT" which will start with your remote IP address, and
do different things based on different IP addresses. (I'm assuming
tcsh has something similar to 'case / esac' in bash)
Checkout `env` and see if there are any other identifying options.
TjL
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
David,
Sadly not. This is a supercomputing cluster that I need
two-factor authentication to just log into, and I'm not an admin. Of
course, I can easily alter my .ssh/config, so SendEnv is easy, but it's not
accepted on the other side.
Post by Matt Thompson
I'm guessing "Matt wants automatic colored terminals" won't
exactly fly as a reason to change /etc/sshd_config :D
Post by Matt Thompson
Post by David Brown
If you are able to edit /etc/ssh/ssh_config on the local
machine, and /etc/ssh/sshd_config on the remote machine, you can have ssh
pass the environment across.
Post by Matt Thompson
Post by David Brown
SendEnv TERM_PROGRAM
AcceptEnv TERM_PROGRAM
If these are already present, add TERM_PROGRAM, separated by a
space.
Post by Matt Thompson
Post by David Brown
David
Date: Monday, October 15, 2018 at 10:14 AM
Subject: Re: [iterm2-discuss] Managing shell integration with
Linux and Mac (tcsh)
Post by Matt Thompson
Post by David Brown
Hmm. Sadly it looks like TERM_PROGRAM is not an environment
variable on the remote server in either tcsh or bash. I have
TERM=xterm-256color, but no TERM_PROGRAM (perhaps iTerm2 itself sets it?).
Post by Matt Thompson
Post by David Brown
I suppose I could just get used to running 'source
~/.iterm2_shell_integration.tcsh' after I log in, but it sort of defeats
the purpose the nice automatic-ness because I'm lazy and I like how it's
magic as I ssh around :)
Post by Matt Thompson
Post by David Brown
I don't know tcsh syntax, but on bash/zsh you could do something
like
Post by Matt Thompson
Post by David Brown
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]
then
source ~/.iterm2_shell_integration.tcsh
fi
I think that would accomplish what you want.
--
TJ Luoma
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Post by Matt Thompson
All,
This is an odd one. So, I'm trying to get the trick "change
background depending on host" and I managed to do it via my home MacBook
Pro and on a work MacBook Pro. I can log into a computational cluster and
different background! Huzzah!
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
But, I also (mainly) use a Linux workstation at work. Now I
obviously don't have shell integration on that box, but the cluster still
had the "source ~/.iterm2_shell_integration.tcsh" in the .tcshrc.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
(998) $ env | grep -i iterm
(999) $ source ~/.iterm2_shell_integration.tcsh
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C;
]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;C; ]133;D;0
]133;A(1000) $ ]133;B
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
It's like some code the shell integration script sets is not
something that my Linux box (using MATE Terminal) likes at all.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
So I'm a bit flummoxed. I'd like to use the shell integration,
but I can't source it on the remote I want to use it on automatically. Does
anyone know any SSH or other techniques that can allow a remote to know
where the incoming? I'd love to do "if from macbook, source" but I just
cannot see how.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Or, perhaps, do you think it's just an old tcsh on one of the
sides that can't handle something?
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
Thanks for any help,
Matt
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
Post by David Brown
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
Post by David Brown
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
Post by Matt Thompson
--
You received this message because you are subscribed to the
Google Groups "iterm2-discuss" group.
Post by Matt Thompson
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of
Better Anna Rampton
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better
Anna Rampton
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna Rampton
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Matt Thompson
“The fact is, this is about us identifying what we do best and
finding more ways of doing less of it better” -- Director of Better Anna
Rampton
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Brown
2018-10-15 19:49:53 UTC
Permalink
It doesn't seem to do this for me. I'm running stable on my Mac, but I tried
exporting "LC_ITERM2=1" in the environment and then ssh'ing. But on the other
end, no LC_ITERM2 in my environment. 
This has to be configured on both ends. On Mac OS, the AcceptEnv has
LC_* as the rule. But, on my Gentoo Linux machine, it accepts only a
specific list of environment variables that start with LC, and others
will not be accepted.

So unfortunately, this doesn't really help the original poster, who is
not able to edit the sshd_config.

David
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...