libtmux.Server.if_shell
Python
- Python
- Ruby Unavailable
- Lua Unavailable
- TypeScript
- Rust Unavailable
- Go
- Java
- .NET
- C++ Unavailable
- Swift Unavailable
- Module
- libtmux
- Declared in
- Server
- Package
- libtmux
- Source
- src/libtmux/server.py
- Other languages
- Ruby Lua TypeScript Rust GoJava.NET C++ Swift
-
Execute a tmux command conditionally via
$ tmux if-shell.- Parameters
-
-
shell_command ( str ) – Shell command whose exit status determines which tmux command runs.
-
tmux_command ( str ) – Tmux command to run if *shell_command* succeeds (exit 0).
-
else_command ( str | None ) – Tmux command to run if *shell_command* fails (non-zero exit).
-
background ( bool | None ) – Run the shell command in the background (
-bflag). -
target_pane ( str | None ) – Target pane for format expansion (
-tflag).
-
In other ports Run one tmux command or another, on a shell test
- Ruby No source-verified Ruby equivalent is recorded for this operation.
- Lua No source-verified Lua equivalent is recorded for this operation.
- TypeScript
server.Server.ifShell - Rust no equivalent on
Server - Go
tmux.Server.IfShell - Java
io.github.libtmux.Server.Server.ifShell - .NET
LibTmux.Server.IfShellAsync - C++ no equivalent on
Server - Swift no equivalent on
Server
Examples
>>> server.if_shell('true', 'set -g @if_test yes')>>> server.cmd('show-options', '-gv', '@if_test').stdout[0]'yes'await server.ifShell("test -d /tmp", "display-message 'present'");0 declared, 0 inherited