fix(shift): off by one typo

This commit is contained in:
Shil S 2020-07-19 16:32:20 -07:00
parent ca8d0d4975
commit 59c398cb92
1 changed files with 1 additions and 1 deletions

View File

@ -507,7 +507,7 @@ rm "$QUIT"
<sect1 id="sect_09_07"><title>The shift built-in</title>
<sect2 id="sect_09_07_01"><title>What does it do?</title>
<para>The <command>shift</command> command is one of the Bourne shell built-ins that comes with Bash. This command takes one argument, a number. The positional parameters are shifted to the left by this number, <emphasis>N</emphasis>. The positional parameters from <varname>N+1</varname> to <varname>$#</varname> are renamed to variable names from <varname>$1</varname> to <varname>$# - N+1</varname>.</para>
<para>Say you have a command that takes 10 arguments, and N is 4, then <varname>$4</varname> becomes <varname>$1</varname>, <varname>$5</varname> becomes <varname>$2</varname> and so on. <varname>$10</varname> becomes <varname>$7</varname> and the original <varname>$1</varname>, <varname>$2</varname> and <varname>$3</varname> are thrown away.</para>
<para>Say you have a command that takes 10 arguments, and N is 3, then <varname>$4</varname> becomes <varname>$1</varname>, <varname>$5</varname> becomes <varname>$2</varname> and so on. <varname>$10</varname> becomes <varname>$7</varname> and the original <varname>$1</varname>, <varname>$2</varname> and <varname>$3</varname> are thrown away.</para>
<para>If N is zero or greater than <varname>$#</varname>, the positional parameters are not changed (the total number of arguments, see <xref linkend="sect_07_02_01_02" />) and the command has no effect. If N is not present, it is assumed to be 1. The return status is zero unless N is greater than <varname>$#</varname> or less than zero; otherwise it is non-zero.</para>
</sect2>
<sect2 id="sect_09_07_02"><title>Examples</title>