Re: bash: request for a way to return variables to the parent of a subshell

2008-07-22 Thread Richard Neill
Thank you. That's a really neat solution - and it would never have occurred to me. I always think from left to right! Richard Paul Jarc wrote: Richard Neill <[EMAIL PROTECTED]> wrote: the aim is to parse the output of "ffmpeg -formats" to see whether certain codecs are supported by that bui

Re: bash: request for a way to return variables to the parent of a subshell

2008-07-22 Thread Paul Jarc
Richard Neill <[EMAIL PROTECTED]> wrote: > the aim is to parse the output of "ffmpeg -formats" to see whether > certain codecs are supported by that build. I'd use something like: while read line; do ... done < <(ffmpeg -formats 2>/dev/null) That puts ffmpeg into a subshell instead of read. p

Re: bash: request for a way to return variables to the parent of a subshell

2008-07-22 Thread Richard Neill
Dear Eric, Thank you for your helpful answer. I'd understood that bash *doesn't* pass info back from the child to the parent, but I didn't realise that it was fundamentally *impossible* to do in Unix. I guess that tempfiles would do it - though that's rather ugly. Is there any way to use "re

Re: bash: request for a way to return variables to the parent of a subshell

2008-07-22 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Richard Neill on 7/22/2008 8:04 PM: | This prints "Match-1", but does not print "Match-2". | | The only way to get data out of the read-subshell is by something like | "exit 2", and looking at $? You can also use files. The position wit

Re: bash: request for a way to return variables to the parent of a subshell

2008-07-22 Thread Chris F.A. Johnson
On 2008-07-23, Richard Neill wrote: > At the moment, variables set within a subshell can never be accessed by > the parent script. This is true, even for an implicit subshell such as > caused by read. The subshell is caused by the ipe, not by read. > For example, consider the following (sli

bash: request for a way to return variables to the parent of a subshell

2008-07-22 Thread Richard Neill
At the moment, variables set within a subshell can never be accessed by the parent script. This is true, even for an implicit subshell such as caused by read. For example, consider the following (slightly contrived example) touch example-file ls -l | while read LINE ; do i

Bash: proposal for >>> operator

2008-07-22 Thread Richard Neill
Dear All, Might I propose bash should add another operator, >>> for "redirection into a variable". This would be by analogy with the <<< operator. For example, we can currently use <<< to save an "echo", by doing this: TEXT="Hello World" grep -o 'hello' <<<"$TEXT" instead of TE

Typo in subst.c

2008-07-22 Thread Gintautas Miliauskas
Hello, #: subst.c:4367 #, c-format msgid "cannout reset nodelay mode for fd %d" There's a typo: "cannout" -> "can not" Best regards, -- Gintautas Miliauskas

Re: inconsistent treatment of backslash-bang

2008-07-22 Thread pk
On Tuesday 22 July 2008 13:38, Lawrence D'Oliveiro wrote: > And even with the specialness of bang turned off, it still doesn't work > right: > > [EMAIL PROTECTED]:~> set +H > [EMAIL PROTECTED]:~> echo "hi there!" > hi there! > [EMAIL PROTECTED]:~> echo "hi there\!" > hi there\! > [EMAIL PROTECTED

Re: inconsistent treatment of backslash-bang

2008-07-22 Thread Andreas Schwab
Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: > And even with the specialness of bang turned off, it still doesn't work > right: > > [EMAIL PROTECTED]:~> set +H > [EMAIL PROTECTED]:~> echo "hi there!" > hi there! > [EMAIL PROTECTED]:~> echo "hi there\!" > hi there\! > [EMAIL PROTECTED]:~> echo h

Re: inconsistent treatment of backslash-bang

2008-07-22 Thread Lawrence D'Oliveiro
Chet Ramey wrote: > Bash and csh both permit backslash to inhibit history expansion when in > double quotes. If a printable character has special meaning in syntax for representing data strings, then in any situation where it's special, it is expected to be possible to disable that specialness by