elvish
Interact with Elvish shell and script
TLDR
Start an interactive shell session
Execute specific [c]ommands
Execute a specific script
SYNOPSIS
elvish [options] [script-file [arg ...]]
When invoked without arguments, Elvish starts an interactive shell session. If script-file is provided, Elvish executes the commands from the file and then exits.
PARAMETERS
-c command
Executes the specified command string and then exits. This is useful for running Elvish scripts or commands non-interactively.
-l
Starts Elvish as a login shell. This typically involves reading specific startup files (e.g., ~/.elvish/rc.elv) in a particular order.
-D dir
Changes the initial working directory to dir before starting the shell or executing a script.
-v
Prints the Elvish version information to standard output and then exits.
-h
Displays a concise help message detailing command-line options and then exits.
script-file
Specifies an Elvish script file to execute. The shell will run the commands in this file sequentially.
arg ...
Additional arguments passed to the script-file, accessible within the script.
DESCRIPTION
Elvish is an open-source cross-platform shell and scripting language, aiming to be a modern and powerful alternative to traditional UNIX shells like Bash or Zsh. Unlike POSIX-compliant shells, Elvish introduces a unique syntax and a more programmatic approach, blending aspects of functional programming and traditional shell features. Its core design focuses on consistency, expressiveness, and a rich interactive experience.
Key features include a powerful and programmable completion system, structured data handling (lists and maps), a robust module system, and support for concurrent operations. Elvish provides intuitive error messages and aims to make shell scripting more approachable and less error-prone. While it can be used for general system automation, its strengths particularly shine in interactive use, offering a highly customizable and efficient command-line environment for developers and power users. Written in Go, it compiles into a single static binary.
CAVEATS
Elvish is not POSIX compliant, meaning its syntax and built-in commands differ significantly from traditional shells like Bash. This can lead to a learning curve for users accustomed to older shells and may require rewriting existing shell scripts. While powerful, its community and ecosystem are smaller compared to established shells, potentially affecting the availability of pre-built integrations or extensive third-party resources. It is also under active development, so some features or behaviors might evolve over time.
INTERACTIVE MODE
Elvish excels in its interactive mode, providing advanced features such as context-aware tab completion, a highly configurable prompt, and an integrated command history browser. It aims to make the command line a more efficient and pleasant environment for daily tasks.
SCRIPTING LANGUAGE PARADIGM
Unlike traditional shells that primarily string together external commands, Elvish introduces a more structured, list-oriented programming language. It treats everything as data, allowing for powerful manipulation of lists, maps, and channels, enabling more complex and less error-prone scripts than traditional text-processing pipelines.
HISTORY
Elvish was conceived and primarily developed by Xiang-Fu Liu (xiaq) starting around 2013-2014. The motivation behind its creation was to address perceived limitations and inconsistencies in traditional UNIX shells, aiming to build a more powerful and intuitive command-line environment and scripting language. It was designed from the ground up to be a hybrid tool – both an interactive shell and a full-fledged programming language. Written entirely in Go, Elvish leverages Go's concurrency primitives and strong type system to offer a robust and performant user experience. Its development continues with a focus on refining its unique language features and enhancing its interactive capabilities.