diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2018-03-16 08:18:53 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2018-03-16 08:18:53 +0000 |
commit | 77a47b2c5e7c3243743bd8d7594366f498e9cef7 (patch) | |
tree | fb807c0b0c20db34f5108df67da6b4d64e5bc8e6 /doc/dollarat.html | |
parent | 3fde941ae33bd70edf015b3c72997aef703ebf6d (diff) | |
download | execline-77a47b2c5e7c3243743bd8d7594366f498e9cef7.tar.xz |
More modifications, and doc change
Diffstat (limited to 'doc/dollarat.html')
-rw-r--r-- | doc/dollarat.html | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/doc/dollarat.html b/doc/dollarat.html index 8249bd3..d9346fa 100644 --- a/doc/dollarat.html +++ b/doc/dollarat.html @@ -3,9 +3,9 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Language" content="en" /> - <title>execline: the dollarat command</title> - <meta name="Description" content="execline: the dollarat command" /> - <meta name="Keywords" content="execline command dollarat" /> + <title>execline: the $@ command</title> + <meta name="Description" content="execline: the $@ command" /> + <meta name="Keywords" content="execline command $@" /> <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> --> </head> <body> @@ -16,28 +16,28 @@ <a href="//skarnet.org/">skarnet.org</a> </p> -<h1> The <tt>dollarat</tt> program </h1> +<h1> The <tt>$@</tt> program </h1> <p> -<tt>dollarat</tt> prints the positional parameters of an execline script. +<tt>$@</tt> prints the positional parameters of an execline script. </p> <h2> Interface </h2> <pre> - dollarat [ -n ] [ -0 | -d <em>delimchar</em> ] + $@ [ -n ] [ -0 | -d <em>delimchar</em> ] </pre> <ul> - <li> <tt>dollarat</tt> reads the number <em>n</em> of "positional + <li> <tt>$@</tt> reads the number <em>n</em> of "positional parameters" in the <tt>#</tt> environment variable. If that variable -is not set or does not contain a valid <em>n</em>, <tt>dollarat</tt> +is not set or does not contain a valid <em>n</em>, <tt>$@</tt> exits 100. </li> - <li> <tt>dollarat</tt> prints the value of the <tt>1</tt> environment + <li> <tt>$@</tt> prints the value of the <tt>1</tt> environment variable, then <em>delimchar</em>, then the value of the <tt>2</tt> environment variable... and so on until <tt><em>n</em></tt>. If one of -these variables is not set, <tt>dollarat</tt> exits 100. </li> - <li> If everything runs OK, <tt>dollarat</tt> exits 0. This makes it +these variables is not set, <tt>$@</tt> exits 100. </li> + <li> If everything runs OK, <tt>$@</tt> exits 0. This makes it one of the rare "exiting" execline commands. </li> </ul> @@ -49,7 +49,7 @@ one of the rare "exiting" execline commands. </li> <li> <tt>-d</tt> <em>delimchar</em> : use the character <em>delimchar</em> as separator between the arguments. Default: <tt>\n</tt>. If <em>delimchar</em> has more than one character, only the first one is -used. If <em>delimchar</em> is the empty string, then <tt>dollarat</tt> +used. If <em>delimchar</em> is the empty string, then <tt>$@</tt> will output the positional parameters as a <a href="el_transform.html#netstrings">sequence of netstrings</a> (and the <tt>-n</tt> option will be ignored). </li> @@ -61,12 +61,16 @@ data to programs that know how to handle null-separated lists. </li> <h2> Notes </h2> <ul> - <li> You can use <tt>dollarat -d ""</tt> along with the + <li> The <tt>$@</tt> word gets interpreted by execline as the list of +all positional parameters. To make sure it's not substituted, and +correctly refers to the <tt>$@</tt> command, make sure to escape the +<tt>$</tt> character in execline scripts: <tt>\\$@</tt>. </li> + <li> You can use <tt>$@ -d ""</tt> along with the <a href="forbacktickx.html">forbacktickx</a> command to reliably loop over the positional parameters: <pre> #!/command/execlineb - forbacktickx -d "" ARG { dollarat -d "" } + forbacktickx -d "" ARG { \\$@ -d "" } dosomething $ARG </pre> @@ -78,7 +82,7 @@ or other fancy characters. </li> use a null-separated list, which will work the same way: <pre> #!/command/execlineb - forbacktickx -0 ARG { dollarat -0 } + forbacktickx -0 ARG { \\$@ -0 } dosomething $ARG </pre> </li> </ul> |