1*bcb5dc79SHONG Yifan<!-- Generated with Stardoc: http://skydoc.bazel.build --> 2*bcb5dc79SHONG Yifan 3*bcb5dc79SHONG YifanSkylib module containing shell utility functions. 4*bcb5dc79SHONG Yifan 5*bcb5dc79SHONG Yifan<a id="shell.array_literal"></a> 6*bcb5dc79SHONG Yifan 7*bcb5dc79SHONG Yifan## shell.array_literal 8*bcb5dc79SHONG Yifan 9*bcb5dc79SHONG Yifan<pre> 10*bcb5dc79SHONG Yifanshell.array_literal(<a href="#shell.array_literal-iterable">iterable</a>) 11*bcb5dc79SHONG Yifan</pre> 12*bcb5dc79SHONG Yifan 13*bcb5dc79SHONG YifanCreates a string from a sequence that can be used as a shell array. 14*bcb5dc79SHONG Yifan 15*bcb5dc79SHONG YifanFor example, `shell.array_literal(["a", "b", "c"])` would return the string 16*bcb5dc79SHONG Yifan`("a" "b" "c")`, which can be used in a shell script wherever an array 17*bcb5dc79SHONG Yifanliteral is needed. 18*bcb5dc79SHONG Yifan 19*bcb5dc79SHONG YifanNote that all elements in the array are quoted (using `shell.quote`) for 20*bcb5dc79SHONG Yifansafety, even if they do not need to be. 21*bcb5dc79SHONG Yifan 22*bcb5dc79SHONG Yifan 23*bcb5dc79SHONG Yifan**PARAMETERS** 24*bcb5dc79SHONG Yifan 25*bcb5dc79SHONG Yifan 26*bcb5dc79SHONG Yifan| Name | Description | Default Value | 27*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- | 28*bcb5dc79SHONG Yifan| <a id="shell.array_literal-iterable"></a>iterable | A sequence of elements. Elements that are not strings will be converted to strings first, by calling `str()`. | none | 29*bcb5dc79SHONG Yifan 30*bcb5dc79SHONG Yifan**RETURNS** 31*bcb5dc79SHONG Yifan 32*bcb5dc79SHONG YifanA string that represents the sequence as a shell array; that is, 33*bcb5dc79SHONG Yifanparentheses containing the quoted elements. 34*bcb5dc79SHONG Yifan 35*bcb5dc79SHONG Yifan 36*bcb5dc79SHONG Yifan<a id="shell.quote"></a> 37*bcb5dc79SHONG Yifan 38*bcb5dc79SHONG Yifan## shell.quote 39*bcb5dc79SHONG Yifan 40*bcb5dc79SHONG Yifan<pre> 41*bcb5dc79SHONG Yifanshell.quote(<a href="#shell.quote-s">s</a>) 42*bcb5dc79SHONG Yifan</pre> 43*bcb5dc79SHONG Yifan 44*bcb5dc79SHONG YifanQuotes the given string for use in a shell command. 45*bcb5dc79SHONG Yifan 46*bcb5dc79SHONG YifanThis function quotes the given string (in case it contains spaces or other 47*bcb5dc79SHONG Yifanshell metacharacters.) 48*bcb5dc79SHONG Yifan 49*bcb5dc79SHONG Yifan 50*bcb5dc79SHONG Yifan**PARAMETERS** 51*bcb5dc79SHONG Yifan 52*bcb5dc79SHONG Yifan 53*bcb5dc79SHONG Yifan| Name | Description | Default Value | 54*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- | 55*bcb5dc79SHONG Yifan| <a id="shell.quote-s"></a>s | The string to quote. | none | 56*bcb5dc79SHONG Yifan 57*bcb5dc79SHONG Yifan**RETURNS** 58*bcb5dc79SHONG Yifan 59*bcb5dc79SHONG YifanA quoted version of the string that can be passed to a shell command. 60*bcb5dc79SHONG Yifan 61*bcb5dc79SHONG Yifan 62