You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2id="quoting-expressions-in-the-shell">Quoting expressions in the shell</h2>
89
-
<p>Expression arguments must be quoted in the shell. The most common style is single quotes, which prevent the shell from interpreting special characters inside the expression:</p>
<p>An expression containing spaces or special characters needs to be quoted, otherwise mapshaper will interpret the parts as separate arguments and produce a syntax error. Single quotes are the most common style:</p>
<p>Backtick quoting is also available as a third option when both single and double quotes appear in the expression.</p>
96
-
<p>Backslash escapes (<code>\"</code>, <code>\'</code>) can also resolve quoting conflicts, but the shell processes them before passing the expression to mapshaper, which can strip the backslashes and produce a JS syntax error. This gets particularly confusing inside shell scripts and Makefiles, where an additional level of escaping may be needed. When possible, switching the outer quote style is simpler than relying on backslash escapes.</p>
96
+
<p>Backslash escapes (<code>\"</code>, <code>\'</code>) can also resolve quoting conflicts, but when running commands in a shell the shell processes them before passing the expression to mapshaper, which can strip the backslashes and produce a JS syntax error. This gets particularly confusing inside shell scripts and Makefiles, where an additional level of escaping may be needed. When possible, switching the outer quote style is simpler than relying on backslash escapes.</p>
<divclass="docs-toc-title">On this page</div><ul><liclass="lvl-2"><ahref="#what-is-a-javascript-expression">What is a JavaScript expression?</a></li><liclass="lvl-2"><ahref="#quoting-expressions-in-the-shell">Quoting expressions in the shell</a></li><liclass="lvl-2"><ahref="#where-expressions-appear">Where expressions appear</a></li><liclass="lvl-2"><ahref="#the-execution-context">The execution context</a></li><liclass="lvl-3"><ahref="#field-assignment">Field assignment</a></li><liclass="lvl-3"><ahref="#multiple-statements">Multiple statements</a></li><liclass="lvl-2"><ahref="#feature-properties-this">Feature properties (this)</a></li><liclass="lvl-3"><ahref="#all-layer-types">All layer types</a></li><liclass="lvl-3"><ahref="#polygon-polyline-and-point-layers-with-geometry">Polygon, polyline and point layers (with geometry)</a></li><liclass="lvl-3"><ahref="#polygon-only">Polygon-only</a></li><liclass="lvl-3"><ahref="#polyline-only">Polyline-only</a></li><liclass="lvl-3"><ahref="#point-only">Point-only</a></li><liclass="lvl-2"><ahref="#layer-level-properties-thislayer">Layer-level properties (this.layer)</a></li><liclass="lvl-2"><ahref="#helper-functions">Helper functions</a></li><liclass="lvl-2"><ahref="#calc-expressions">Calc expressions</a></li><liclass="lvl-2"><ahref="#pair-expressions-a-and-b">Pair expressions (A and B)</a></li><liclass="lvl-2"><ahref="#layer-level-expressions--if--define">Layer-level expressions (-if, -define)</a></li><liclass="lvl-2"><ahref="#template-expressions--run">Template expressions (-run)</a></li><liclass="lvl-2"><ahref="#loading-helpers">Loading helpers</a></li><liclass="lvl-2"><ahref="#sharing-state-across-commands">Sharing state across commands</a></li><liclass="lvl-2"><ahref="#common-pitfalls">Common pitfalls</a></li><liclass="lvl-2"><ahref="#examples">Examples</a></li><liclass="lvl-2"><ahref="#see-also">See also</a></li></ul>
639
+
<divclass="docs-toc-title">On this page</div><ul><liclass="lvl-2"><ahref="#what-is-a-javascript-expression">What is a JavaScript expression?</a></li><liclass="lvl-2"><ahref="#quoting-expressions">Quoting expressions</a></li><liclass="lvl-2"><ahref="#where-expressions-appear">Where expressions appear</a></li><liclass="lvl-2"><ahref="#the-execution-context">The execution context</a></li><liclass="lvl-3"><ahref="#field-assignment">Field assignment</a></li><liclass="lvl-3"><ahref="#multiple-statements">Multiple statements</a></li><liclass="lvl-2"><ahref="#feature-properties-this">Feature properties (this)</a></li><liclass="lvl-3"><ahref="#all-layer-types">All layer types</a></li><liclass="lvl-3"><ahref="#polygon-polyline-and-point-layers-with-geometry">Polygon, polyline and point layers (with geometry)</a></li><liclass="lvl-3"><ahref="#polygon-only">Polygon-only</a></li><liclass="lvl-3"><ahref="#polyline-only">Polyline-only</a></li><liclass="lvl-3"><ahref="#point-only">Point-only</a></li><liclass="lvl-2"><ahref="#layer-level-properties-thislayer">Layer-level properties (this.layer)</a></li><liclass="lvl-2"><ahref="#helper-functions">Helper functions</a></li><liclass="lvl-2"><ahref="#calc-expressions">Calc expressions</a></li><liclass="lvl-2"><ahref="#pair-expressions-a-and-b">Pair expressions (A and B)</a></li><liclass="lvl-2"><ahref="#layer-level-expressions--if--define">Layer-level expressions (-if, -define)</a></li><liclass="lvl-2"><ahref="#template-expressions--run">Template expressions (-run)</a></li><liclass="lvl-2"><ahref="#loading-helpers">Loading helpers</a></li><liclass="lvl-2"><ahref="#sharing-state-across-commands">Sharing state across commands</a></li><liclass="lvl-2"><ahref="#common-pitfalls">Common pitfalls</a></li><liclass="lvl-2"><ahref="#examples">Examples</a></li><liclass="lvl-2"><ahref="#see-also">See also</a></li></ul>
Copy file name to clipboardExpand all lines: docs/guides/expressions.html.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,9 +77,9 @@ mapshaper data.geojson \
77
77
-o out.geojson
78
78
```
79
79
80
-
## Quoting expressions in the shell
80
+
## Quoting expressions
81
81
82
-
Expression arguments must be quoted in the shell. The most common style is single quotes, which prevent the shell from interpreting special characters inside the expression:
82
+
An expression containing spaces or special characters needs to be quoted, otherwise mapshaper will interpret the parts as separate arguments and produce a syntax error. Single quotes are the most common style:
Backtick quoting is also available as a third option when both single and double quotes appear in the expression.
95
95
96
-
Backslash escapes (`\"`, `\'`) can also resolve quoting conflicts, but the shell processes them before passing the expression to mapshaper, which can strip the backslashes and produce a JS syntax error. This gets particularly confusing inside shell scripts and Makefiles, where an additional level of escaping may be needed. When possible, switching the outer quote style is simpler than relying on backslash escapes.
96
+
Backslash escapes (`\"`, `\'`) can also resolve quoting conflicts, but when running commands in a shell the shell processes them before passing the expression to mapshaper, which can strip the backslashes and produce a JS syntax error. This gets particularly confusing inside shell scripts and Makefiles, where an additional level of escaping may be needed. When possible, switching the outer quote style is simpler than relying on backslash escapes.
Copy file name to clipboardExpand all lines: llms-full.txt
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -2333,9 +2333,9 @@ mapshaper data.geojson \
2333
2333
-o out.geojson
2334
2334
```
2335
2335
2336
-
## Quoting expressions in the shell
2336
+
## Quoting expressions
2337
2337
2338
-
Expression arguments must be quoted in the shell. The most common style is single quotes, which prevent the shell from interpreting special characters inside the expression:
2338
+
An expression containing spaces or special characters needs to be quoted, otherwise mapshaper will interpret the parts as separate arguments and produce a syntax error. Single quotes are the most common style:
Backtick quoting is also available as a third option when both single and double quotes appear in the expression.
2351
2351
2352
-
Backslash escapes (`\"`, `\'`) can also resolve quoting conflicts, but the shell processes them before passing the expression to mapshaper, which can strip the backslashes and produce a JS syntax error. This gets particularly confusing inside shell scripts and Makefiles, where an additional level of escaping may be needed. When possible, switching the outer quote style is simpler than relying on backslash escapes.
2352
+
Backslash escapes (`\"`, `\'`) can also resolve quoting conflicts, but when running commands in a shell the shell processes them before passing the expression to mapshaper, which can strip the backslashes and produce a JS syntax error. This gets particularly confusing inside shell scripts and Makefiles, where an additional level of escaping may be needed. When possible, switching the outer quote style is simpler than relying on backslash escapes.
0 commit comments