Przejdลบ do treล›ci

๐Ÿง  Fish

Fish (Friendly Interactive SHell) is a modern, userโ€‘friendly shell designed primarily for interactive use. It focuses on usability, discoverability, and developer productivity rather than POSIX compatibility or scripting portability.


๐ŸŽ“ Who This Is For

  • Developers customizing their interactive terminal experience
  • Users who want a friendly, discoverable shell
  • Teams standardizing developer environments
  • Anyone evaluating shells for interactive workflows

๐Ÿงฉ Role in the Ecosystem

  • Popular as a personal interactive shell on developer machines
  • Provides advanced UX features out of the box (autosuggestions, syntax highlighting)
  • Not intended for system scripting or automation
  • Rarely available in servers, CI/CD runners, or minimal container images

๐Ÿงฉ Key Characteristics

  • Nonโ€‘POSIX syntax (incompatible with /bin/sh and bash)
  • Builtโ€‘in help, completions, and suggestions
  • Humanโ€‘friendly, readable syntax
  • No need for complex configuration frameworks
  • Different scripting model than sh/bash/zsh

๐Ÿ”ง Notable Features

  • Autosuggestions and completions:

Fish suggests commands based on history and context automatically.

  • Humanโ€‘friendly variable syntax:
1
2
set name "robert"
echo $name
  • Arrays by default:
1
2
set arr one two three
echo $arr[2]
  • Builtโ€‘in help system:
1
help

โš ๏ธ Limitations & Pitfalls

  • Not POSIX compliant
  • Scripts written in fish are not portable to sh/bash
  • Not suitable for automation, CI/CD, or system scripts
  • Not available in most production environments
  • Syntax differs significantly from other shells, making migration harder

๐Ÿง  When to Use Fish

  • As a personal interactive shell
  • Developer workstations
  • Improving terminal ergonomics and productivity
  • Environments where scripting portability is not required

โŒ When Not to Use Fish

  • System scripts
  • CI/CD pipelines
  • Container entrypoints
  • Crossโ€‘platform automation
  • Any script intended for /bin/sh or bash

โœ… Best Practices

  • Use fish only for interactive sessions
  • Keep configuration minimal and versionโ€‘controlled
  • Avoid writing automation in fish syntax
  • Use POSIX sh or bash for scripting
  • Document clearly when fish is required for a developer environment

๐Ÿงช Testing Fish Scripts

1
2
fish --no-execute script.fish   # syntax check
fish --debug-level=1 script.fish

๐Ÿง  Summary

Fish is excellent for humans at a terminal, offering a modern, ergonomic interactive experience. It is not designed for automation or scripting portability โ€” use it to enhance productivity, not to run production systems.