help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shell


From: Louis-David Mitterrand
Subject: Re: shell
Date: Sun, 10 Sep 2006 23:45:16 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Sun, Sep 10, 2006 at 03:32:25PM -0600, Philip Guenther wrote:
> On 9/10/06, Louis-David Mitterrand <address@hidden> 
> wrote:
> >I'm trying to get this rule to work:
> >
> >        id3tag:
> >                echo mp3/blues/john_lee_hooker/boom_boom/ | IFS=/ read 
> >                form genre artist album && echo "$$form $$genre $$artist 
> >                $$album"
> >
> >but it echoes nothing.
> 
> Normally, the various commands in a pipeline are all executed in
> separate processes.  Some shells will handle the last command of the
> pipeline in the original process if it's a 'read', but last I checked
> that was not required by the POSIX standard.

Yes, zsh behaves that way.

> So, it appears that the shell used by make by default (/bin/sh)
> doesn't do that special handling.  There are a number of workaround,
> the simplest being to make the 'last command of the pipeline' contain
> not just the 'read' but also the commands that need the variable
> values.  That can be done by grouping them into a subshell with
> parens:
> 
> id3tag:
>        echo mp3/blues/john_lee_hooker/boom_boom/ | \
>            ( IFS=/ read form genre artist album && \
>              echo "$$form $$genre $$artist $$album" )

This works fine!

> >When issued from a shell it works.
> 
> Apparently your login shell performs that special handling, at least
> when used interactively.

Thanks for your helpful and detailed explanation. 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]