Why does a Bash shell script write prompts followed by reads and do it right?

2015-08-31 Thread Robert Parker
A trivial script example that just works: #!/bin/bash # echo a prompt and write the user's response to a file. echo "Enter variable name: " read ans echo "$ans" > tmpfil echo "Enter variable type: " read ans echo "$ans" >> tmpfil echo "Enter variable default value: " read ans echo "$ans" >>

Re: Why does a Bash shell script write prompts followed by reads and do it right?

2015-08-31 Thread John McKown
Not a bug, so likely the wrong forum. Have you tried doing a fflush() after the fputs()? I.e. something to tell the Kernel to "write this out immediately!". In the case of write(), I think you need to use the O_SYNC flag in the open() call. On Mon, Aug 31, 2015 at 11:25 AM, Robert Parker

Re: Problem with @Q

2015-08-31 Thread Chet Ramey
On 8/29/15 2:40 AM, isabella parakiss wrote: > In the devel branch, setting IFS=\' seems to break @Q: It actually causes a lot more than that to misbehave, and has for a very long time. It looks like "'" is an uncommon IFS value. This will be fixed for the next bash-4.4 testing release. --

Re: Race condition in read -t

2015-08-31 Thread Chet Ramey
On 8/28/15 7:52 PM, Oleg Popov wrote: > Description: > Function reset_alarm() in read.def first resets SIGALRM handler and > then cancels alarm. Sometimes, SIGALRM comes between those 2 calls and > crashes (sub)shell. > > Repeat-By: > while sleep 0.00$RANDOM; do echo

Re: CPPFLAGS vs project include arguments in lib/glob

2015-08-31 Thread Chet Ramey
On 8/30/15 9:41 AM, Poor Yorick wrote: > It looked like a stray config.h from somewhere else might be getting picked > up. > Sure enough, making sure the project includes took precedence over any > includes > in CPPFLAGS solved the problem: Thanks for the report, I'll take a look. -- ``The lyf

Re: \c-handling in $'-strings

2015-08-31 Thread Chet Ramey
On 8/28/15 7:28 PM, Helmut Karlowski wrote: > Hello > > The bash-manual says: > > Words of the form $'string' are treated specially. The word expands to > string, with backslash-escaped characters replaced as specified by the > ANSI C standard. Backslash escape sequences, if present, are