# io.github.libtmux.Server.Server.ifShell

- **Module:** io.github.libtmux.Server.Server
- **Package:** io.github.libtmux:libtmux
- **Language:** Java
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-java/blob/842228310449e879ebcaa3f910597757c9dbffd6/libtmux/src/main/java/io/github/libtmux/Server.java#L425
- **Page:** https://libtmux.org/en/java/latest/reference/io-github-libtmux-server-server-ifshell/

```
io.github.libtmux.Server.Server.ifShell(condition: String, whenTrue: String) -> void
```

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 {@code #(...)} in the condition before a shell sees it, and shell quoting does
not prevent that. Pass any interpolated value through {@link 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
