Re: Bash "bug" - in "read -e -r var"
On 12/15/14 11:13 AM, Dan Douglas wrote: > Ah ok I thought -e basically negated the effect of -r for some reason but I > guess not (like you can still use \ to escape line continuations without -r it > seems). They're separate but kind of clumsy to use together for line continuations. `read' ends up calling readline N times for every N-1 backslash-escaped newlines. If -r is supplied it doesn't need to do anything out of the ordinary for \. In terms of backslash escaping characters in the line read, backslash isn't really special to readline, it's just mapped to self-insert. You still have to use quoted-insert to insert characters that are bound to line editing commands. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: Bash "bug" - in "read -e -r var"
On Monday, December 15, 2014 10:47:29 AM Chet Ramey wrote: > On 12/15/14, 7:11 AM, Dan Douglas wrote: > > > I'm generally interested in what read with (or without) -r combined with -e > > even means. > > I'm not sure what you're driving at. The -e option says how to read the > line; the -r option affects how the characters are processed after being > read. > Ah ok I thought -e basically negated the effect of -r for some reason but I guess not (like you can still use \ to escape line continuations without -r it seems). Long ago I assumed "read <<
Re: Bash "bug" - in "read -e -r var"
On 12/15/14, 7:11 AM, Dan Douglas wrote: > I'm generally interested in what read with (or without) -r combined with -e > even means. I'm not sure what you're driving at. The -e option says how to read the line; the -r option affects how the characters are processed after being read. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: Bash "bug" - in "read -e -r var"
On 12/15/14, 7:11 AM, Dan Douglas wrote: > I understand that read's now basically useless behavior without -r > was originally there to make using it interactively without a line editor > slightly easier. Ask David Korn, since he originally added options to the read builtin. None of the `pure' Bourne shells ever had it. It may be the case that it was easier to use \ to enter characters that were special to word splitting, since without it it's very difficult to read values containing spaces when using more than one variable. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: Bash "bug" - in "read -e -r var"
On Sunday, December 14, 2014 04:27:51 PM Chet Ramey wrote: > On 12/13/14 12:06 AM, Daniel A. Gauthier wrote: > > > > If you do a "read -e -r var" in bash, and use tab completion to fill-in > > a filename, it fills in "My\ File\ Name.txt" and that's exactly > > what's read into the variable. The fix is simple, in tab completion, > > the text placed into the buffer should be in the same format that the > > read is expecting, so if "-r" is in effect for the read operation, the > > the filename should be added to the buffer unquoted. > > This seems like an awfully specific case (-r in effect, one or fewer > variables specified) to change readline for. I question whether it's of > general interest. > I'm generally interested in what read with (or without) -r combined with -e even means. I understand that read's now basically useless behavior without -r was originally there to make using it interactively without a line editor slightly easier. -- Dan Douglas
Re: Bash "bug" - in "read -e -r var"
On 12/13/14 12:06 AM, Daniel A. Gauthier wrote: > > If you do a "read -e -r var" in bash, and use tab completion to fill-in > a filename, it fills in "My\ File\ Name.txt" and that's exactly > what's read into the variable. The fix is simple, in tab completion, > the text placed into the buffer should be in the same format that the > read is expecting, so if "-r" is in effect for the read operation, the > the filename should be added to the buffer unquoted. This seems like an awfully specific case (-r in effect, one or fewer variables specified) to change readline for. I question whether it's of general interest. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/