[mosh-devel] Is there a way to tell if you are running inside mosh?

TJ Luoma luomat at gmail.com
Wed Nov 14 14:52:11 EST 2018


Hi folks

I just installed mosh after hearing about it for awhile but never
having used it before. I'm not sure if this is the best place to ask
questions. If not, please let me know. I checked the IRC channel but
it seemed to be empty.

I have a rather complex zsh prompt which uses colors using ANSI color
codes… to be honest, I just copied it from some website several years
ago, and I don't even understand how it works myself.

When I connect via ssh, it works fine. When I connect via mosh, it
looks weird. Here's a picture, showing SSH on top, and MOSH on bottom:

https://www.dropbox.com/s/y1xuktzuom648f8/ssh-on-top-mosh-on-bottom.png?dl=0

Ideally, I'd like to figure out how to make this work under MOSH, but
in the meantime I'd like to setup my .zshrc to use a different prompt
when I am connected via MOSH instead of SSH.

However, I can't seem to figure out how to tell the difference
programmatically. The only thing I knew to try to check was `printenv`
but that didn't show me anything, at least as far as I can tell.

Thanks for any pointers

TjL


--
TJ Luoma
TJ @ MacStories
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Twitter: @tjluoma



More information about the mosh-devel mailing list