Shells

Each shell represents a command-line interpreter, and is associated with:

  • a unique shell ID

  • a human-readable name

  • an icon (emoji / unicode character)

  • a detection function

  • various metadata in its info() method

Shell usage

Each shell is materialized by a Shell object, from which you can access various metadata:

>>> from extra_platforms import BASH
>>> BASH
Shell(id='bash', name='Bash')
>>> BASH.id
'bash'
>>> BASH.current
False
>>> BASH.info()
{'id': 'bash', 'name': 'Bash', 'icon': '🐚', 'url': 'https://www.gnu.org/software/bash/', 'current': False, 'version': None, 'path': None}

To check if the current environment is running in a specific shell, use the corresponding detection function:

>>> from extra_platforms import is_bash
>>> is_bash()
False

The current shell can be obtained via the current_shell() function:

>>> from extra_platforms import current_shell
>>> current_shell()
Shell(id='unknown_shell', name='Unknown shell')

Recognized shells

Icon

Symbol

Name

Detection function

🪶

ASH

Almquist Shell

is_ash()

BASH

Bash

is_bash()

CMD

Command Prompt

is_cmd()

𝐂

CSH

C shell

is_csh()

💨

DASH

Dash

is_dash()

🐟

FISH

Fish

is_fish()

𝐊

KSH

Korn shell

is_ksh()

𝜈

NUSHELL

Nushell

is_nushell()

🔷

POWERSHELL

PowerShell

is_powershell()

𝐓

TCSH

tcsh

is_tcsh()

🐍

XONSH

Xonsh

is_xonsh()

ZSH

Zsh

is_zsh()

Hint

The UNKNOWN_SHELL trait represents an unrecognized shell. It is not included in the ALL_SHELLS group, and will be returned by current_shell() if the current shell is not recognized.

Groups of shells

Icon

Symbol

Description

Detection

Canonical

🐚

ALL_SHELLS

All shells

is_any_shell()

💲

BOURNE_SHELLS

Bourne-compatible shells

is_bourne_shells()

🅲

C_SHELLS

C shells

is_c_shells()

OTHER_SHELLS

Other shells

is_other_shells()

⌨️

WINDOWS_SHELLS

Windows shells

is_windows_shells()

Hint

Canonical groups are non-overlapping groups that together cover all recognized traits. They are marked with a ⬥ icon in the table above.

Other groups are provided for convenience, but overlap with each other or with canonical groups.

        ---
config:
  sankey:
    height: 800
    showValues: false
    width: 800

---
sankey-beta

ALL_SHELLS,BOURNE_SHELLS,5
ALL_SHELLS,OTHER_SHELLS,3
ALL_SHELLS,WINDOWS_SHELLS,2
ALL_SHELLS,C_SHELLS,2
BOURNE_SHELLS,ASH,1
BOURNE_SHELLS,BASH,1
BOURNE_SHELLS,DASH,1
BOURNE_SHELLS,KSH,1
BOURNE_SHELLS,ZSH,1
OTHER_SHELLS,FISH,1
OTHER_SHELLS,NUSHELL,1
OTHER_SHELLS,XONSH,1
WINDOWS_SHELLS,CMD,1
WINDOWS_SHELLS,POWERSHELL,1
C_SHELLS,CSH,1
C_SHELLS,TCSH,1
    
        ---
config:
  mindmap:
    padding: 5

---
mindmap
    ((🐚 ALL_SHELLS))
        )⌨️ WINDOWS_SHELLS(
            (▶ CMD)
            (🔷 POWERSHELL)
        )◇ OTHER_SHELLS(
            (🐟 FISH)
            (𝜈 NUSHELL)
            (🐍 XONSH)
        )🅲 C_SHELLS(
            (𝐂 CSH)
            (𝐓 TCSH)
        )💲 BOURNE_SHELLS(
            (🪶 ASH)
            (# BASH)
            (💨 DASH)
            (𝐊 KSH)
            (ℤ ZSH)
    

Predefined shells

Shell definitions and metadata.

extra_platforms.ASH = Shell(id='ash', name='Almquist Shell')
extra_platforms.BASH = Shell(id='bash', name='Bash')
extra_platforms.CMD = Shell(id='cmd', name='Command Prompt')
extra_platforms.CSH = Shell(id='csh', name='C shell')
extra_platforms.DASH = Shell(id='dash', name='Dash')
extra_platforms.FISH = Shell(id='fish', name='Fish')
extra_platforms.KSH = Shell(id='ksh', name='Korn shell')
extra_platforms.NUSHELL = Shell(id='nushell', name='Nushell')
extra_platforms.POWERSHELL = Shell(id='powershell', name='PowerShell')
extra_platforms.TCSH = Shell(id='tcsh', name='tcsh')
extra_platforms.UNKNOWN_SHELL = Shell(id='unknown_shell', name='Unknown shell')
extra_platforms.XONSH = Shell(id='xonsh', name='Xonsh')
extra_platforms.ZSH = Shell(id='zsh', name='Zsh')