Fish - the friendly interactive shell

Table of Contents

1. Fish shell

1.1. Fish: Remove the greeting message

set -U fish_greeting ""

Relatedly, you can define a function called fish_greeting (same name as the variable) if you want to run some custom commands (like fortune, or task) when starting an interactive shell.

1.2. Fish: Variables

  • use set -h for more info
  • there are 4 scopes: local, function, global and universal
  • global scope is just like global scope in other languages
  • universal variables are shared and persisted; this means they can be slightly slower than global variables because they need to be written to disk
  • set set VARIABLE_NAME VALUES
  • unset set -e VARIABLE_NAME
  • export with -x
  • test if a variable exists set -q VARIABLE_NAME

1.2.1. Fish: Arrays

  • are 1 indexed
  • are not created differently from other variables
  • are indexed with $var[1]
  • remove an item set -e var[idx]
  • can index from the end $var[-1]
  • index range is supported $var[1..4], bounds are inclusive

2. Backlinks

Created: 2024-04-06 Sat 00:49