ela
Contents

ManualAgents

Which quotes to use

In the terminalela --spec which-quotes-to-use

A string's quotes depend on what it holds and where it stands.

The textWriteExample
text with a variable or a command's output"..."echo "built $name on $(date)"
a regular expression, or any \, as a command's word'...'grep -E '^v[0-9]+\.[0-9]+$' tags.txt
a flag holding * or ?'...' around the whole flaggrep -r word '--include=*.mk' .
a regular expression, or text with a ', in code`...`newest = re.match(`^v\d+\.\d+$`, $tag)
a pattern with both ' and a \[*] and [.] for \* and \., in "..."grep "it's [*]new[*]" notes.txt
a ' in text"...", or ''' for several linesecho "it's done"
several lines, with variables""", the text from the next linebody = """ ... """
several lines with $ in them, as written''', the text from the next linescript = ''' ... '''
  • Code is an assignment, a call's argument, a condition or a return.
  • In '...' and backticks a \ is a backslash. In "..." a \ starts an escape, and "\d" or "\." is an error that says to use single quotes.
  • A * inside a flag is a glob, as zsh and fish have it: --include=*.mk unquoted looks for files and stops when none match.
  • ela -c '…' takes one line of code. Code of several lines goes in a here-document, ela <<'EOF'.

In "..." a variable stands as it does in code:

To put inWriteNot
an item"$pair[0]", a computed index "${$chars[$i + 1]}""${pair[0]}", bash's form
a map's value"$info['kind']", the key in single quotes"${info["kind"]}": the inner " ends the string
text straight after a name"${name}.d2""$name.d2", which reads a field d2
a call's value"${str.join($names, ", ")}""str.join($names, ", ")"
  • + never joins text: "${a}${b}" does.

Text goes to a program's stdin through a pipe; ela has no <<<:

echo $msg | git commit -F -

(ela --spec strings)