Przejdลบ do treล›ci

๐ŸŒ The Shell Landscape

Not all shells are equal. Understanding the differences is critical for writing portable scripts.

๐Ÿ† The Main Contenders

Shell POSIXยน Default On Vibe / Use Case
sh (Bourne) โœ… Yes Alpine, Minimal Linux The granddaddy. Strict, portable, minimal.
bash (Bourne Again) โš ๏ธ Mostly Most Linux distros The industry standard. Powerful but full of "bashisms".
zsh (Z Shell) โš ๏ธ Mostly macOS, Kali Modern, plugin-heavy, great for interactive use.
dash (Debian Almquist) โœ… Yes Debian/Ubuntu (/bin/sh) Fast, lightweight, strictly POSIX.
fish (Friendly) โŒ No N/A (User install) Beautiful, auto-suggestions, non-standard scripting.
ksh (Korn) โš ๏ธ Mostly AIX, Solaris Legacy enterprise UNIX.

๐Ÿ”— The /bin/sh Trap

On modern systems, /bin/sh is often a symlink, not a real shell.

1
2
3
$ ls -l /bin/sh
/bin/sh -> dash   # On Ubuntu/Debian (POSIX mode)
/bin/sh -> bash  # On RHEL/CentOS (POSIX mode)

โš ๏ธ DevOps Rule: Never assume sh is bash. If you write #!/bin/sh, you are promising to only use POSIX features.

๐Ÿ› ๏ธ Check Your Shell

1
2
echo $0        # Current shell name
echo $SHELL    # Your default login shell

ยน POSIX: A family of standards for maintaining compatibility between operating systems.