Fish displays incremental suggestions as the user types, based on command history and the current directory. This functions similarly to Bash's Ctrl+R history search, but is always on, giving the user continuous feedback while typing commands. Fish also includes feature-rich tab completion, with support for expanding file paths (with wildcards and brace expansion), environment variables, and command-specific completions. Command-specific completions, including options with descriptions, can be to some extent generated from the commands' man pages, but custom completions can also be included with software or written by users of the shell.3
The creator of Fish preferred to add new features as commands rather than syntax. This made features more discoverable, as the built-in features allow searching commands with options and help texts. Functions can also include human readable descriptions. A special help command gives access to all the fish documentation in the user's web browser.4
The syntax resembles a POSIX compatible shell (such as Bash), but deviates in many ways5
Some language constructs, like pipelines, functions and loops, have been implemented using so called subshells in other shell languages. Subshells are child programs that run a few commands in order to perform a task, then exit back to the parent shell. This implementation detail typically has the side effect that any state changes made in the subshell, such as variable assignments, do not propagate to the main shell. Fish never creates subshells for language features; all builtins happen within the parent shell.
This Bash example doesn't do what it seems: because the loop body is a subshell, the update to $found is not persistent.
Workaround:
Fish example:
Fish has a feature known as universal variables, which allows a user to permanently assign a value to a variable across all the user's running fish shells. The variable value is remembered across logouts and reboots, and updates are immediately propagated to all running shells.
or
"$(expression)" or (expression | string collect)
Liljencrantz, Axel (2005-05-17). "Fish - A user-friendly shell". Linux Weekly News. Retrieved 2010-03-24. https://lwn.net/Articles/136232 ↩
"Fish docs: design". Retrieved 2021-04-09. https://fishshell.com/docs/current/design.html ↩
"Writing your own completions". fish shell. Archived from the original on 2024-08-31. https://fishshell.com/docs/current/completions.html ↩
Linux.com. CLI Magic: Enhancing the shell with fish. Retrieved 2010-03-24. https://www.linux.com/news/cli-magic-enhancing-shell-fish ↩
Paul, Ryan (19 December 2005). "An in-depth look at fish: the friendly interactive shell". Ars Technica. Retrieved 10 March 2015. the Posix syntax has several missing or badly implemented features, including variable scoping, arrays, and functions. For this reason, fish strays from the Posix syntax in several important places. https://arstechnica.com/information-technology/2005/12/linux-20051218/2/ ↩
"Bash Pitfalls". Retrieved 2016-07-10. This page shows common errors that Bash programmers make. (...) You will save yourself from many of these pitfalls if you simply always use quotes and never use word splitting for any reason! Word splitting is a broken legacy misfeature inherited from the Bourne shell that's stuck on by default if you don't quote expansions. The vast majority of pitfalls are in some way related to unquoted expansions, and the ensuing word splitting and globbing that result. http://mywiki.wooledge.org/BashPitfalls ↩
"RFC: Add binding to expand/evaluate tokens on commandline". GitHub. 2013-05-16. Retrieved 2021-04-09. https://github.com/fish-shell/fish-shell/issues/751 ↩
"printf does not support \e". fish issues. 11 Jul 2013. Retrieved 24 March 2016. https://github.com/fish-shell/fish-shell/issues/910 ↩