# Yet another shell (yash) manual

Yuki Watanabe
`<magicant@wonderwand.net>`
version 2.56.1, 2024-03-20

## Contents

1. Introduction

2. Invocation

   1. Command line arguments

   2. Initialization of yash

3. Syntax

   1. Tokens and keywords

   2. Quotations

   3. Aliases

   4. Simple commands

   5. Pipelines

   6. And/or lists

   7. Command separators and asynchronous commands

   8. Compound commands

      1. Grouping

      2. If command

      3. While and until loops

      4. For loop

      5. Case command

      6. Double-bracket command

   9. Function definition

4. Parameters and variables

   1. Positional parameters

   2. Special parameters

   3. Variables

      1. Variables used by the shell

      2. Arrays

5. Word expansions

   1. Tilde expansion

   2. Parameter expansion

      1. Prefix

      2. Parameter name

      3. Index

      4. Modifier

   3. Command substitution

   4. Arithmetic expansion

   5. Brace expansion

   6. Field splitting

   7. Pathname expansion

      1. Extension in pathname expansion

6. Pattern matching notation

   1. Normal characters

   2. Single-character wildcard

   3. Multi-character wildcard

   4. Bracket expression

   5. Normal characters (in bracket expression pattern)

   6. Range expressions

   7. Collating symbols

   8. Equivalence classes

   9. Character classes

7. Redirection

   1. Redirection to files

      1. Socket redirection

   2. Duplication of file descriptors

   3. Here documents and here strings

   4. Pipeline redirection

   5. Process redirection

8. Command execution

   1. Execution of simple commands

      1. Command search

   2. Termination of the shell

   3. Functions

      1. Local variables

   4. Command execution environment

      1. Subshells

9. Interactive mode

   1. Prompts

   2. Command history

   3. Mail checking

10. Job control

    1. Job ID

11. Built-in commands

    1. Types of built-in commands

    2. Syntax of command arguments

12. Line-editing

    1. Shell options on line-editing

    2. Editing modes

    3. Line-editing commands

       1. Basic editing commands

       2. Motion commands

       3. Editing commands

       4. Completion commands

       5. Vi-specific commands

       6. Emacs-specific commands

       7. History-related commands

       8. Search mode commands

    4. Escape sequences

    5. Command line completion

       1. Completion details

    6. Command line prediction

13. POSIXly-correct mode

14. Frequently asked questions and troubleshooting

    1. How can I use Unicode (non-ASCII) characters?

    2. Line-editing does not work

15. Formal definition of command syntax

    1. Tokenization

       1. Token classification

       2. Comments

    2. Syntax

       1. Alias substitution

## Built-ins

Parenthesized letters indicate the types of built-in commands: (S) for special, (M) mandatory, (L) elective, and (X) extension. Substitutive built-ins are not marked.

### All built-ins in alphabetic order

- `.` (dot) (S)

- `:` (colon) (S)

- `[` (bracket)

- `alias` (M)

- `array` (X)

- `bg` (M)

- `bindkey` (L)

- `break` (S)

- `cd` (M)

- `command` (M)

- `complete` (L)

- `continue` (S)

- `dirs` (L)

- `disown` (L)

- `echo`

- `eval` (S)

- `exec` (S)

- `exit` (S)

- `export` (S)

- `false` (M)

- `fc` (M)

- `fg` (M)

- `getopts` (M)

- `hash` (M)

- `help` (L)

- `history` (L)

- `jobs` (M)

- `kill` (M)

- `local` (L)

- `popd` (L)

- `printf`

- `pushd` (L)

- `pwd` (M)

- `read` (M)

- `readonly` (S)

- `return` (S)

- `set` (S)

- `shift` (S)

- `suspend` (L)

- `test`

- `times` (S)

- `trap` (S)

- `true` (M)

- `type` (M)

- `typeset` (L)

- `ulimit` (M)

- `umask` (M)

- `unalias` (M)

- `unset` (S)

- `wait` (M)

### Categorized list of built-ins

#### Execution control commands

- `eval` (S)

- `.` (dot) (S)

- `exec` (S)

- `command` (M)

- `hash` (M)

- `break` (S)

- `continue` (S)

- `return` (S)

- `suspend` (L)

- `exit` (S)

#### Command execution environment

- `set` (S)

- `ulimit` (M)

- `umask` (M)

- `trap` (S)

- `cd` (M)

- `pwd` (M)

- `times` (S)

#### Job control and signalling

- `jobs` (M)

- `fg` (M)

- `bg` (M)

- `wait` (M)

- `disown` (L)

- `kill` (M)

- `trap` (S)

#### Parameters and variables

- `typeset` (L)

- `export` (S)

- `local` (L)

- `readonly` (S)

- `array` (X)

- `set` (S)

- `shift` (S)

- `read` (M)

- `getopts` (M)

- `unset` (S)

#### Working directory

- `cd` (M)

- `pwd` (M)

- `pushd` (L)

- `popd` (L)

- `dirs` (L)

#### Aliases

- `alias` (M)

- `unalias` (M)

#### Command history

- `fc` (M)

- `history` (L)

#### Printing strings

- `echo`

- `printf`

#### Line-editing

- `bindkey` (L)

- `complete` (L)

#### Miscellaneous

- `help` (L)

- `:` (colon) (S)

- `true` (M)

- `false` (M)

- `[` (bracket), `test`

- `type` (M)