Skip to content

Detect whether the current shell is running under mosh

Notifications You must be signed in to change notification settings

testfailed/is_mosh

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

is_mosh

Detects whether the current shell is running under mosh or not.

It even works in a shell running inside tmux sessions, attached from a mosh session.

Usage

You can either source the script or execute it as a sub-shell.

if is_mosh; then
  echo 'running under mosh'
else
  echo 'It is not under mosh'
fi

Try is_mosh -v or is_mosh --verbose to see messages printed to stdout (mosh or not mosh).

NOTE: pstree and tmux 2.1+ are required (#1).

Why did you made this?

mosh is awesome, but doesn't support 24-bit true color. I needed a way to detect and disable true color feature on mosh environments. To see an example of vimrc to automatically turn on/off termguicolors, see my vimrc. Please see a stackexchange thread for the discussion.

LICENSE

The MIT License (c) 2017-2020 Jongwook Choi (@wookayin)

About

Detect whether the current shell is running under mosh

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%