GNU Rush |
|
Restricted User Shell |
Sergey Poznyakoff |
insert
statementThe insert
statement inserts new positional argument at a given
position. Its syntax is similar to set
:
Shift arguments starting from n one position to the right (so
that n becomes n+1 etc.) and insert value at
argv[n]
.
In the second form, the value to be inserted is computed by applying sed-expression s-expr to value.
Both value and s-expr are subject to variable expansion and backreference interpretation.
Example using this statement to insert the --root=/tmp
argument
at position 1:
insert [1] = "--root=/tmp"
Note that when inserting multiple arguments (e.g. an option with a value), you have two possibilities. First, you can insert each argument at its corresponding position. For example, to insert two arguments ‘--root’ and ‘/tmp’ starting at position 1, one can use:
insert [1] = "--root" insert [2] = "/tmp"
Otherwise, you can revert the arguments and insert them at the same position, as shown in the example below:
insert [1] = "/tmp" insert [1] = "--root"
This document was generated on January 2, 2022 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.