Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Chet Ramey Newsgroups: gnu.bash.bug Subject: Re: read and env variables + POSIX => SEGFAULT Date: Mon, 12 Oct 2015 17:05:27 -0400 Lines: 35 Approved: bug-bash@gnu.org Message-ID: References: <5619D0F1.6080904@tlinx.org> Reply-To: chet.ramey@case.edu NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1444683941 24433 208.118.235.17 (12 Oct 2015 21:05:41 GMT) X-Complaints-To: action@cs.stanford.edu Cc: chet.ramey@case.edu To: Linda Walsh , isabella parakiss , bug-bash Envelope-to: bug-bash@gnu.org X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: <5619D0F1.6080904@tlinx.org> X-Junkmail-Status: score=10/60, host=mpv5.cwru.edu X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 129.22.105.37 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11636 On 10/10/15 11:01 PM, Linda Walsh wrote: >> a= read a <<< x;echo $? > 0 >> declare -p a > declare -- a="x" > # the manpage claims "one line is read from [the input], and the result > # is split by words and assigns 1st word to 1st var and so forth, but > # apparently the reading of 1 line is optional -- though this is consistent > # with the fact that read can be told to read some number of characters > and # return when the limit is reached. So technically, read doesn't > "read one line", > # but read whatever is on 'input' up to 1 line. (DOC clarification?) This is terribly wrong. The command in question is `a= read a <<< x'. The here-string construct takes the following word and, like a here document, makes it the standard input to the command. The standard input is then a file consisting of a single line: x\n. It's basically shorthand for read a <