2019-02-27 20:54:19 +00:00
|
|
|
## shell.array_literal
|
2019-02-22 20:29:00 +00:00
|
|
|
|
|
|
|
<pre>
|
2019-02-27 20:54:19 +00:00
|
|
|
shell.array_literal(<a href="#shell.array_literal-iterable">iterable</a>)
|
2019-02-22 20:29:00 +00:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
Creates a string from a sequence that can be used as a shell array.
|
|
|
|
|
|
|
|
For example, `shell.array_literal(["a", "b", "c"])` would return the string
|
|
|
|
`("a" "b" "c")`, which can be used in a shell script wherever an array
|
|
|
|
literal is needed.
|
|
|
|
|
|
|
|
Note that all elements in the array are quoted (using `shell.quote`) for
|
|
|
|
safety, even if they do not need to be.
|
|
|
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
<table class="params-table">
|
|
|
|
<colgroup>
|
|
|
|
<col class="col-param" />
|
|
|
|
<col class="col-description" />
|
|
|
|
</colgroup>
|
|
|
|
<tbody>
|
2019-02-27 20:54:19 +00:00
|
|
|
<tr id="shell.array_literal-iterable">
|
2019-02-22 20:29:00 +00:00
|
|
|
<td><code>iterable</code></td>
|
|
|
|
<td>
|
|
|
|
required.
|
|
|
|
<p>
|
|
|
|
A sequence of elements. Elements that are not strings will be
|
|
|
|
converted to strings first, by calling `str()`.
|
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
2019-02-27 20:54:19 +00:00
|
|
|
## shell.quote
|
2019-02-22 20:29:00 +00:00
|
|
|
|
|
|
|
<pre>
|
2019-02-27 20:54:19 +00:00
|
|
|
shell.quote(<a href="#shell.quote-s">s</a>)
|
2019-02-22 20:29:00 +00:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
Quotes the given string for use in a shell command.
|
|
|
|
|
|
|
|
This function quotes the given string (in case it contains spaces or other
|
|
|
|
shell metacharacters.)
|
|
|
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
<table class="params-table">
|
|
|
|
<colgroup>
|
|
|
|
<col class="col-param" />
|
|
|
|
<col class="col-description" />
|
|
|
|
</colgroup>
|
|
|
|
<tbody>
|
2019-02-27 20:54:19 +00:00
|
|
|
<tr id="shell.quote-s">
|
2019-02-22 20:29:00 +00:00
|
|
|
<td><code>s</code></td>
|
|
|
|
<td>
|
|
|
|
required.
|
|
|
|
<p>
|
|
|
|
The string to quote.
|
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|