Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

io.github.libtmux.Server.Server.ifShell

Java

View as Markdown

Module
io.github.libtmux.Server
Declared in
Server
Package
io.github.libtmux:libtmux
Source
libtmux/src/main/java/io/github/libtmux/Server.java
Other languages
Python Ruby Lua TypeScript Rust Go.NET C++ Swift
ifShell ( condition : String , whenTrue : String ) → void ( condition : String , whenTrue : String , whenFalse : String ) → void
methodoverload2 overloads [source]
methodoverload2 overloads [source]
ifShell

Runs one tmux command or another, according to whether a shell command succeeds.

The choosing happens inside tmux rather than here, which is the point: the condition and both outcomes go out as one request, so nothing can change between asking and acting.

tmux expands #(...) in the condition before a shell sees it, and shell quoting does not prevent that. Pass any interpolated value through TmuxFormats#literal unless you mean it to be expanded.

Parameters
  • condition ( String ) – a shell command, judged by its exit status

  • whenTrue ( String ) – the tmux command to run when the condition succeeds

  • whenFalse ( String ) – the tmux command to run when it does not

In other ports Run one tmux command or another, on a shell test

0 declared, 0 inherited

Esc

Type to search.