LinuxCommandLibrary

elvish

Interact with Elvish shell and script

TLDR

Start an interactive shell session

$ elvish
copy

Execute specific [c]ommands
$ elvish -c "[echo 'elvish is executed']"
copy

Execute a specific script
$ elvish [path/to/script.elv]
copy

SYNOPSIS

elvish [options] [script_file | -c command]

PARAMETERS

-version
    Display the elvish version and exit.

-buildinfo
    Display detailed build information and exit.

-rcfile file
    Specify the elvish rc file (default: ~/.elvish/rc.elv). This overrides the standard location.

-norc
    Do not load the elvish rc file.

-c command
    Execute the specified command string and exit. Useful for running single commands without needing a separate script.

script_file
    Execute the specified elvish script file.

-lsp
    Start a language server to provide language features to editors and other tools

DESCRIPTION

Elvish is a modern, expressive command-line shell designed for both interactive use and scripting. It combines a powerful scripting language with user-friendly features such as structured data, a rich standard library, and a helpful error reporting system. Elvish aims to provide a more consistent and predictable shell experience compared to traditional shells like Bash or Zsh. Key features include a robust syntax, pipelines that can handle structured data, and a focus on making it easier to write reliable and maintainable shell scripts. It also offers features like a powerful completions system that understands the structure of commands and suggests relevant options and arguments, as well as a helpful prompt that displays information about the current directory, Git status, and other relevant context. Elvish can interact with external programs and the file system in a way which is predictable and maintainable. Elvish is written in Go and aims to improve the overall user experience with intelligent tab completion and an error message system to make writing shell commands more convenient for the end user.

KEY CONCEPTS

Elvish uses structured data for input and output. This allows you to process data more easily and reliably than with traditional text-based pipelines. The language emphasizes composability, enabling you to create complex commands by combining simpler ones. It is type-safe and predictable.

INSTALLATION

You can install Elvish via package managers or from source. The official documentation provides detailed instructions for different platforms.

REPL

When you run elvish without any arguments, you get the REPL. This means the shell operates in the Read Evaluate Print Loop mode.

HISTORY

Elvish development started in 2013 and has been continually evolving. It seeks to address perceived shortcomings in existing shells, such as Bash and Zsh, by providing a more modern, structured, and predictable language for both interactive use and scripting. The initial focus was on creating a usable and powerful interactive shell, which gradually expanded to include a more comprehensive scripting language. The goal is to offer a shell that simplifies everyday command-line tasks and provides a solid foundation for more complex automation and scripting tasks.

The shell is written in Go. The initial development focussed on an interpreted version of the shell. Later a compiler was added to improve the performance.

SEE ALSO

bash(1), zsh(1), fish(1)

Copied to clipboard