| 1 | ---
|
| 2 | in_progress: yes
|
| 3 | body_css_class: width40 help-body
|
| 4 | default_highlighter: oils-sh
|
| 5 | preserve_anchor_case: yes
|
| 6 | ---
|
| 7 |
|
| 8 | Mini Languages
|
| 9 | ===
|
| 10 |
|
| 11 | This chapter in the [Oils Reference](index.html) describes "mini-languages".
|
| 12 |
|
| 13 | In contrast, the main sub languages of YSH are [command](chap-cmd-lang.html),
|
| 14 | [word](chap-word-lang.html), and [expression](chap-expr-lang.html).
|
| 15 |
|
| 16 | <div id="toc">
|
| 17 | </div>
|
| 18 | <h2 id="sublang">Other Shell Sublanguages</h2>
|
| 19 |
|
| 20 | ## Arithmetic
|
| 21 |
|
| 22 | ### arith-context
|
| 23 |
|
| 24 | ### sh-numbers
|
| 25 |
|
| 26 | ### sh-arith
|
| 27 |
|
| 28 | ### sh-logical
|
| 29 |
|
| 30 | ### sh-bitwise
|
| 31 |
|
| 32 | ## Boolean
|
| 33 |
|
| 34 | ### dbracket
|
| 35 |
|
| 36 | Compatible with bash.
|
| 37 |
|
| 38 | ### bool-expr
|
| 39 |
|
| 40 | ### bool-infix
|
| 41 |
|
| 42 | ### bool-path
|
| 43 |
|
| 44 | ### bool-str
|
| 45 |
|
| 46 | ### bool-other
|
| 47 |
|
| 48 | ## Patterns
|
| 49 |
|
| 50 | ### glob-pat
|
| 51 |
|
| 52 | TODO: glob syntax
|
| 53 |
|
| 54 | ### extglob
|
| 55 |
|
| 56 | TODO: extended glob syntax
|
| 57 |
|
| 58 | ### regex
|
| 59 |
|
| 60 | Part of [dbracket]($osh-help)
|
| 61 |
|
| 62 | ## Other Sublang
|
| 63 |
|
| 64 | ### braces
|
| 65 |
|
| 66 | ### histsub
|
| 67 |
|
| 68 | History substitution uses `!`.
|
| 69 |
|
| 70 | ### char-escapes
|
| 71 |
|
| 72 | These backslash escape sequences are used in `echo -e`, [printf]($osh-help),
|
| 73 | and in C-style strings like `$'foo\n'`:
|
| 74 |
|
| 75 | \\ backslash
|
| 76 | \a alert (BEL)
|
| 77 | \b backspace
|
| 78 | \c stop processing remaining input
|
| 79 | \e the escape character \x1b
|
| 80 | \f form feed
|
| 81 | \n newline
|
| 82 | \r carriage return
|
| 83 | \t tab
|
| 84 | \v vertical tab
|
| 85 | \xHH the byte with value HH, in hexadecimal
|
| 86 | \uHHHH the unicode char with value HHHH, in hexadecimal
|
| 87 | \UHHHHHHHH the unicode char with value HHHHHHHH, in hexadecimal
|
| 88 |
|
| 89 | Also:
|
| 90 |
|
| 91 | \" Double quote.
|
| 92 |
|
| 93 | Inconsistent octal escapes:
|
| 94 |
|
| 95 | \0NNN echo -e '\0123'
|
| 96 | \NNN printf '\123'
|
| 97 | echo $'\123'
|
| 98 |
|
| 99 | TODO: Verify other differences between `echo -e`, `printf`, and `$''`. See
|
| 100 | `frontend/lexer_def.py`.
|
| 101 |
|