Skip to main content

Module detect

Module detect 

Source
Expand description

Choosing which shell the game runs in.

The player usually types shellgame in bash or fish, and the game should start the same kind of shell. detect decides in this order:

  1. the --shell override (bash or fish, case-insensitive),
  2. the nearest bash, fish or zsh among the parent processes, up to 25 levels. This also sees through wrappers such as make, uv run or sudo, and ignores transient sh -c shells. Linux reads /proc, other systems ask ps,
  3. the basename of $SHELL.

Only bash and fish are supported, so anything else (zsh, a missing $SHELL, …) means bash.

Enums§

ShellKind
The shells the game can run in.

Functions§

detect
Picks the shell to launch. See the module documentation for the order of the checks.