Re: minor: "read line" may read several lines if stdin is a tty

2014-08-27 Thread Chet Ramey
On 8/25/14, 4:24 PM, Stephane Chazelas wrote: > If you run (here testing on Linux): > > bash -c 'read a; echo "<$a>"; tr b c' > > And enter aaabbb > > You see "", but not "ccc". That's because "read" reads up > to 128 bytes of data in one read(2) invocation instead of > reading one byte at a t

[doc] confusion over $0 and positional parameters

2014-08-27 Thread Stephane Chazelas
In info -f bash -n 'Invoking Bash' we find: > `-c' > Read and execute commands from the first non-option ARGUMENT after > processing the options, then exit. Any remaining arguments are > assigned to the positional parameters, starting with `$0'. $0 is generally *not* considere

Re: [doc] confusion over $0 and positional parameters

2014-08-27 Thread Chet Ramey
On 8/27/14, 8:06 AM, Stephane Chazelas wrote: > In > > info -f bash -n 'Invoking Bash' > > we find: > >> `-c' >> Read and execute commands from the first non-option ARGUMENT after >> processing the options, then exit. Any remaining arguments are >> assigned to the positional pa

Re: minor: "read line" may read several lines if stdin is a tty

2014-08-27 Thread Stephane Chazelas
2014-08-27 08:10:01 -0400, Chet Ramey: > On 8/25/14, 4:24 PM, Stephane Chazelas wrote: > > If you run (here testing on Linux): > > > > bash -c 'read a; echo "<$a>"; tr b c' > > > > And enter aaabbb > > > > You see "", but not "ccc". That's because "read" reads up > > to 128 bytes of data in on

Re: minor: "read line" may read several lines if stdin is a tty

2014-08-27 Thread Chet Ramey
On 8/27/14, 3:20 PM, Stephane Chazelas wrote: > However, one could imagine using bash's read to get data off a > tty device not in canonical mode (a serial device used as just a > serial device), or any other non-terminal character device for > that matter (a "strace bash -c 'read < /dev/urandom'"