# LibTmux::Server.if-shell

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Raku
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-raku/blob/e76160bcce6e03976d49424da15b7c31afb2c68e/lib/LibTmux/Server.rakumod#L495
- **Page:** https://libtmux.org/en/raku/latest/reference/libtmux-server-if-shell/

```
method if-shell(Mu $condition, Mu $then, Mu :$otherwise = Invocation,
                Mu :$format = False, Mu :$background = False, Mu :$pane = PaneId,
                Cancellation :$cancel = Cancellation --> Result:D)
```

Execute one of two bounded commands after a shell test, or an explicit FORMAT condition.

Execute one of two bounded commands after a shell test, or an explicit FORMAT condition.

## Parameters

- `$condition` (`Mu`)
- `$then` (`Mu`)
- `$otherwise?` (`Mu`)
- `$format?` (`Mu`)
- `$background?` (`Mu`)
- `$pane?` (`Mu`)
- `$cancel?` (`Cancellation`)

## tmux command

The tmux commands behind `if-shell`.

- [`if-shell`](/en/tmux/latest/manual/if-shell/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_if_shell_entry`](/en/tmux/latest/reference/c-variable-cmd_if_shell_entry/) (attribute)
- [`cmd_if_shell_exec`](/en/tmux/latest/reference/c-function-cmd-if-shell-c-cmd_if_shell_exec/) (function)

## In other ports

Run one tmux command or another, on a shell test

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Server.if_shell`](/en/py/latest/reference/libtmux-server-if_shell/) (method) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`server.Server.ifShell`](/en/ts/latest/reference/server-server-ifshell/) (method) |
| Rust | no equivalent on `Server` |
| Go | [`tmux.Server.IfShell`](/en/go/latest/reference/tmux-server-ifshell/) (method) |
| Java | [`io.github.libtmux.Shell.choose`](/en/java/latest/reference/io-github-libtmux-shell-shell-choose/) (method) |
| C# | [`LibTmux.Server.IfShellAsync`](/en/csharp/latest/reference/libtmux-server-ifshellasync/) (method) |
| C++ | no equivalent on `Server` |
| Swift | no equivalent on `Server` |
| OCaml | No direct public OCaml equivalent is recorded for this operation. |
| Perl | No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands. |

No equivalent is recorded in Ruby, Lua, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.
