Bash set: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:




=<tt>set</tt> and Positional Parameters=


!!!set and Positional Parameters
<pre>
 
{{{
 
arg="a b c"
arg="a b c"
set ${arg}
set ${arg}
 
</pre>
}}}


assigns "a", "b", "c" to positional parameters $1, $2 and $3.  
assigns "a", "b", "c" to positional parameters $1, $2 and $3.  
Line 22: Line 19:
Note that if any of the space-separated argument contains '--', set will try to interpret that sequence of characters:
Note that if any of the space-separated argument contains '--', set will try to interpret that sequence of characters:


{{{
<pre>
set: --: invalid option
set: --: invalid option
}}}
</pre>


so in order to turn it back into positional argument, you will have to <font color=red>??? do something, did not figure it out yet.</font>
so in order to turn it back into positional argument, you will have to <font color=red>??? do something, did not figure it out yet.</font>




__Referenced by:__\\
__Referenced by:__\\
[{INSERT com.ecyrd.jspwiki.plugin.ReferringPagesPlugin WHERE max=20, maxwidth=50}]
[{INSERT com.ecyrd.jspwiki.plugin.ReferringPagesPlugin WHERE max=20, maxwidth=50}]

Revision as of 05:46, 20 February 2016

External

Internal


set and Positional Parameters

arg="a b c"
set ${arg}

assigns "a", "b", "c" to positional parameters $1, $2 and $3.

Note that if any of the space-separated argument contains '--', set will try to interpret that sequence of characters:

set: --: invalid option

so in order to turn it back into positional argument, you will have to ??? do something, did not figure it out yet.



__Referenced by:__\\ [{INSERT com.ecyrd.jspwiki.plugin.ReferringPagesPlugin WHERE max=20, maxwidth=50}]