Symbian3/SDK/Source/GUID-1F809632-82B0-5B4C-92DB-9C4D1316AF03.dita
changeset 7 51a74ef9ed63
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-1F809632-82B0-5B4C-92DB-9C4D1316AF03" xml:lang="en"><title>read</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    13 <p><userinput>read [ -rszpqAclneE ] [ -t [ num ] ] [ -k [ num ] ] [ -d delim
       
    14 ] [ -u n ] [ name[?prompt] ] [ name ... ]</userinput> </p>
       
    15 <p>Read one line and break it into fields using the characters in <codeph>$IFS</codeph> as
       
    16 separators, except as noted below. The first field is assigned to the first <codeph>name</codeph>,
       
    17 the second field to the second <codeph>name</codeph>, and so on, with leftover
       
    18 fields assigned to the last <codeph>name</codeph>. If <codeph>name</codeph> is
       
    19 omitted then REPLY is used for scalars and reply for arrays. </p>
       
    20 <table id="GUID-B061F101-FEDC-535A-8293-79ADF690695D">
       
    21 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
       
    22 <thead>
       
    23 <row>
       
    24 <entry>Option</entry>
       
    25 <entry>Description</entry>
       
    26 </row>
       
    27 </thead>
       
    28 <tbody>
       
    29 <row>
       
    30 <entry><p> <codeph>-r</codeph>  </p> </entry>
       
    31 <entry><p>Raw mode: a <codeph>\</codeph> at the end of a line does not signify
       
    32 line continuation and backslashes in the line don't quote the following character
       
    33 and are not removed. </p> </entry>
       
    34 </row>
       
    35 <row>
       
    36 <entry><p> <codeph>-s</codeph>  </p> </entry>
       
    37 <entry><p>Don't echo back characters if reading from the terminal. Currently
       
    38 does not work with the <codeph>-q</codeph> option. </p> </entry>
       
    39 </row>
       
    40 <row>
       
    41 <entry><p> <codeph>-q</codeph>  </p> </entry>
       
    42 <entry><p>Read only one character from the terminal and set <codeph>name</codeph> to <codeph>y</codeph> if
       
    43 this character was <codeph>y</codeph> or <codeph>Y</codeph> and to <codeph>n</codeph> otherwise.
       
    44 With this flag set the return value is zero only if the character was <codeph>y</codeph> or <codeph>Y</codeph>.
       
    45 Note that this always reads from the terminal, even if used with the<codeph> -p </codeph> or <codeph>-u</codeph> or <codeph>-z </codeph> flags
       
    46 or with redirected input. This option may also be used within <codeph>zle</codeph> widgets. </p> </entry>
       
    47 </row>
       
    48 <row>
       
    49 <entry><p> <codeph>-k[num]</codeph>  </p> </entry>
       
    50 <entry><p>Read only one (or <codeph>num</codeph>) characters. All are assigned
       
    51 to the first <codeph>name</codeph>, without word splitting. This flag is ignored
       
    52 when <codeph>-q </codeph> is present. Input is read from the terminal unless
       
    53 one of <codeph>-u</codeph> or <codeph>-p</codeph> is present. This option
       
    54 may also be used within <codeph>zle</codeph> widgets. </p> </entry>
       
    55 </row>
       
    56 <row>
       
    57 <entry><p> <codeph>-z</codeph>  </p> </entry>
       
    58 <entry><p>Read one entry from the editor buffer stack and assign it to the
       
    59 first <codeph>name</codeph>, without word splitting. Text is pushed onto the
       
    60 stack with <codeph>print -z</codeph> or with <codeph>push-line</codeph> from
       
    61 the line editor. This flag is ignored when the <codeph>-k</codeph> or <codeph>-q</codeph> flags
       
    62 are present. </p> </entry>
       
    63 </row>
       
    64 <row>
       
    65 <entry><p> <codeph>-A</codeph>  </p> </entry>
       
    66 <entry><p>The first <codeph>name</codeph> is taken as the <codeph>name</codeph> of
       
    67 an array and all words are assigned to it. </p> </entry>
       
    68 </row>
       
    69 <row>
       
    70 <entry><p> <codeph>-n</codeph>  </p> </entry>
       
    71 <entry><p>Together with <codeph>-c</codeph>, the number of the word the cursor
       
    72 is on is read. With <codeph>-l</codeph>, the index of the character the cursor
       
    73 is on is read. Note that the command <codeph>name</codeph> is word number
       
    74 1, not word 0, and that when the cursor is at the end of the line, its character
       
    75 index is the length of the line plus one. </p> </entry>
       
    76 </row>
       
    77 <row>
       
    78 <entry><p> <codeph>-u n</codeph>  </p> </entry>
       
    79 <entry><p>Input is read from file descriptor <codeph>n</codeph>. </p> </entry>
       
    80 </row>
       
    81 <row>
       
    82 <entry><p> <codeph>-d delim </codeph>  </p> </entry>
       
    83 <entry><p>Input is terminated by the first character of <codeph>delim</codeph> instead
       
    84 of by newline. </p> </entry>
       
    85 </row>
       
    86 <row>
       
    87 <entry><p> <codeph>-t [ num ] </codeph>  </p> </entry>
       
    88 <entry><p>Test if input is available before attempting to read. If <codeph>num</codeph> is
       
    89 present, it must begin with a digit and will be evaluated to give a number
       
    90 of seconds, which may be a floating point number; in this case the read times
       
    91 out if input is not available within this time. If <codeph>num</codeph> is
       
    92 not present, it is taken to be zero, so that read returns immediately if no
       
    93 input is available. If no input is available, return status 1 and do not set
       
    94 any variables. </p> <p>This option is not available when reading from the
       
    95 editor buffer with<codeph> -z</codeph>, when called from within completion
       
    96 with <codeph>-c</codeph> or <codeph>-l</codeph>, with <codeph>-q</codeph> which
       
    97 clears the input queue before reading, or within <codeph>zle</codeph> where
       
    98 other mechanisms should be used to test for input. </p> <p>Note: <codeph>read</codeph> does
       
    99 not attempt to alter the input processing mode. The default mode is canonical
       
   100 input, in which an entire line is read at a time, so usually <codeph>read
       
   101 -t</codeph> will not read anything until an entire line has been typed. However,
       
   102 when reading from the terminal with <codeph>-k</codeph> input is processed
       
   103 one key at a time; in this case, only availability of the first character
       
   104 is tested, for example <codeph>read -t -k                 2</codeph> can still
       
   105 block on the second character. Use two instances of <codeph>read -t -k</codeph> if
       
   106 this is not what is wanted. </p> </entry>
       
   107 </row>
       
   108 <row>
       
   109 <entry><p> <codeph>?</codeph>  </p> </entry>
       
   110 <entry><p>If the first argument contains a <codeph>?</codeph>, the remainder
       
   111 of this word is used as a prompt on standard error when the shell is interactive. </p> </entry>
       
   112 </row>
       
   113 </tbody>
       
   114 </tgroup>
       
   115 </table>
       
   116 <p>The value (exit status) of <codeph>read</codeph> is 1 when an end-of-file
       
   117 is encountered, or as described for <codeph>-q</codeph>. Otherwise the value
       
   118 is 0. </p>
       
   119 <p>The behavior of some combinations of the <codeph>-k</codeph>, <codeph>-p</codeph>, <codeph>-q</codeph>, <codeph>-u</codeph> and <codeph>-z</codeph> flags is undefined. Presently <codeph>-q</codeph> cancels all the others, <codeph>-p</codeph> cancels <codeph>-u</codeph>, <codeph>-k</codeph> cancels <codeph>-z</codeph>, and otherwise <codeph>-z</codeph> cancels both <codeph>-p</codeph> and <codeph>-u</codeph>. </p>
       
   120 <p> <b>Note:</b> The Symbian platform does not support the use
       
   121 of <codeph>-c</codeph> or <codeph>-l</codeph> option. </p>
       
   122 </conbody></concept>