# server.Server.ifShell

- **Module:** server
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/server.ts#L1593
- **Page:** https://libtmux.org/en/ts/latest/reference/server-server-ifshell/

```
ifShell(
  condition: string,
  command: string,
  options?: IfShellOptions,
): Promise<void>
```

Run one command or another depending on a condition.

## Examples

```ts
await server.ifShell("test -d /tmp", "display-message 'present'");
```

## Parameters

- `condition` (`string`)
- `command` (`string`)
- `options?` (`IfShellOptions`)

## tmux command

The tmux commands behind `ifShell`.

- [`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) |
| 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` |

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