Юрий Пухальский wrote:
Good day!
Theres is a problem with a following code:
echo a:b|IFS=: read a b; echo $a
this seems work
$ echo "a:b" | { IFS=":" read a b; echo $a; }
a
Lhunath (Maarten B.) schrieb:
> My bad. I was under the impression `read` was a Bourne shell-only
thing and not standardized under POSIX.
(not personal for you only, I see that very often)
It would be nice if people actually read POSIX before they talk about it.
Jan
On Mon, Nov 30, 2009 at 04:21:33PM +, Marc Herbert wrote:
> Chris F.A. Johnson a écrit :
> >Why should it be the last element of a pipeline that is executed in
> >the current shell and not the first?
>
> Because that's POSIX' choice?
Because that's what Korn shell does. (But not pdks
pk wrote:
>> Because that's POSIX' choice?
>
> No, POSIX allow either behavior. In fact, it allows any behavior ranging
> from running all parts in their own subshells, to running all parts in the
> current shell.
"...each command of a multi-command pipeline is in a subshell environment;
as a
Marc Herbert wrote:
> Chris F.A. Johnson a écrit :
>>Why should it be the last element of a pipeline that is executed in
>>the current shell and not the first?
>
>
> Because that's POSIX' choice?
No, POSIX allow either behavior. In fact, it allows any behavior ranging
from running all
Chris F.A. Johnson a écrit :
>Why should it be the last element of a pipeline that is executed in
>the current shell and not the first?
Because that's POSIX' choice?
Because the last element is the last one in the data stream. So it feels
more natural to get everything from the last ele
On 30 Nov 2009, at 16:15, Chet Ramey wrote:
>
> Lhunath (Maarten B.) wrote:
>
>> Note that 'read' is a bash feature; not a POSIX shell feature. In that
>> sense, "read" alone is limiting your "portability". So portability in the
>> meaning of POSIX is out of the question.
>
> Pardon me? `re
Lhunath (Maarten B.) wrote:
> Note that 'read' is a bash feature; not a POSIX shell feature. In that
> sense, "read" alone is limiting your "portability". So portability in the
> meaning of POSIX is out of the question.
Pardon me? `read' is a feature of every historical shell and standardize
"Chris F.A. Johnson" writes:
>This works with the output of commands, too:
>
> IFS=- read year month day <<.
> $(date +%Y-%m-%d)
> .
The disadvantage is that the command is executed synchronously.
Andreas.
--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B
On Mon, 30 Nov 2009, Lhunath (Maarten B.) wrote:
> On 30 Nov 2009, at 15:56, Chris F.A. Johnson wrote:
> >
> > On Mon, 30 Nov 2009, Greg Wooledge wrote:
> >
> >> On Mon, Nov 30, 2009 at 11:46:03AM +0100, Lhunath (Maarten B.) wrote:
> >>> Don't use pipelines to send streams to read. Use file red
On 30 Nov 2009, at 15:56, Chris F.A. Johnson wrote:
>
> On Mon, 30 Nov 2009, Greg Wooledge wrote:
>
>> On Mon, Nov 30, 2009 at 11:46:03AM +0100, Lhunath (Maarten B.) wrote:
>>> Don't use pipelines to send streams to read. Use file redirection instead:
>>>
>>> Instead of ''command | read var''
>
On Mon, 30 Nov 2009, Greg Wooledge wrote:
> On Mon, Nov 30, 2009 at 11:46:03AM +0100, Lhunath (Maarten B.) wrote:
> > Don't use pipelines to send streams to read. Use file redirection instead:
> >
> > Instead of ''command | read var''
> > Use ''read var < <(command)''
> >
> > I hardly see a nee
On Mon, 30 Nov 2009, Marc Herbert wrote:
> Lhunath (Maarten B.) a ?crit :
> > On 30 Nov 2009, at 11:34, Marc Herbert wrote:
> >
> >> Eric Blake a ?crit :
> >>> This is E4 in the FAQ:
> >>> ftp://ftp.cwru.edu/pub/bash/FAQ
>
> > Instead of ''commands | read var''
> > Use ''read var < <(commands)''
On 30 Nov 2009, at 14:10, Marc Herbert wrote:
>
> Lhunath (Maarten B.) a écrit :
>> On 30 Nov 2009, at 11:34, Marc Herbert wrote:
>>
>>> Eric Blake a écrit :
This is E4 in the FAQ:
ftp://ftp.cwru.edu/pub/bash/FAQ
>
>> Instead of ''commands | read var''
>> Use ''read var < <(commands)''
Lhunath (Maarten B.) a écrit :
> On 30 Nov 2009, at 11:34, Marc Herbert wrote:
>
>> Eric Blake a écrit :
>>> This is E4 in the FAQ:
>>> ftp://ftp.cwru.edu/pub/bash/FAQ
> Instead of ''commands | read var''
> Use ''read var < <(commands)''
> I hardly see a need to change the existing implementation
On Mon, Nov 30, 2009 at 11:46:03AM +0100, Lhunath (Maarten B.) wrote:
> Don't use pipelines to send streams to read. Use file redirection instead:
>
> Instead of ''command | read var''
> Use ''read var < <(command)''
>
> I hardly see a need to change the existing implementation.
Or for the orig
On 30 Nov 2009, at 11:34, Marc Herbert wrote:
> Eric Blake a écrit :
>>
>> This is E4 in the FAQ:
>> ftp://ftp.cwru.edu/pub/bash/FAQ
>>
>> POSIX permits, but does not require, that the final element of a pipeline
>> be executed in a subshell. Bash uses the subshell, ksh does not.
>> Variable as
Eric Blake a écrit :
>
> This is E4 in the FAQ:
> ftp://ftp.cwru.edu/pub/bash/FAQ
>
> POSIX permits, but does not require, that the final element of a pipeline
> be executed in a subshell. Bash uses the subshell, ksh does not.
> Variable assignments in a subshell do not affect the parent.
I am
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
According to Юрий Пухальский on 11/26/2009 1:02 PM:
> Good day!
>
> Theres is a problem with a following code:
>
> echo a:b|IFS=: read a b; echo $a
This is E4 in the FAQ:
ftp://ftp.cwru.edu/pub/bash/FAQ
POSIX permits, but does not require, that the
19 matches
Mail list logo