• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## shell.array_literal
2
3<pre>
4shell.array_literal(<a href="#shell.array_literal-iterable">iterable</a>)
5</pre>
6
7Creates a string from a sequence that can be used as a shell array.
8
9For example, `shell.array_literal(["a", "b", "c"])` would return the string
10`("a" "b" "c")`, which can be used in a shell script wherever an array
11literal is needed.
12
13Note that all elements in the array are quoted (using `shell.quote`) for
14safety, even if they do not need to be.
15
16
17### Parameters
18
19<table class="params-table">
20  <colgroup>
21    <col class="col-param" />
22    <col class="col-description" />
23  </colgroup>
24  <tbody>
25    <tr id="shell.array_literal-iterable">
26      <td><code>iterable</code></td>
27      <td>
28        required.
29        <p>
30          A sequence of elements. Elements that are not strings will be
31    converted to strings first, by calling `str()`.
32        </p>
33      </td>
34    </tr>
35  </tbody>
36</table>
37
38
39## shell.quote
40
41<pre>
42shell.quote(<a href="#shell.quote-s">s</a>)
43</pre>
44
45Quotes the given string for use in a shell command.
46
47This function quotes the given string (in case it contains spaces or other
48shell metacharacters.)
49
50
51### Parameters
52
53<table class="params-table">
54  <colgroup>
55    <col class="col-param" />
56    <col class="col-description" />
57  </colgroup>
58  <tbody>
59    <tr id="shell.quote-s">
60      <td><code>s</code></td>
61      <td>
62        required.
63        <p>
64          The string to quote.
65        </p>
66      </td>
67    </tr>
68  </tbody>
69</table>
70
71
72