2009/2/5 Michael Homer <mich...@gobolinux.org>:
> On Friday 06 February 2009 10:05:58 Lucas C. Villa Real wrote:
>> On Thu, Feb 5, 2009 at 6:57 PM, Michael Homer <mich...@gobolinux.org> wrote:
>> > On Friday 06 February 2009 09:05:03 luca...@svn.gobolinux.org wrote:
>> >> Author: lucasvr
>> >> Date: 2009-02-05 12:05:02 -0800 (Thu, 05 Feb 2009)
>> >> New Revision: 3859
>> >>
>> >> Modified:
>> >>    trunk/Scripts/Functions/GoboLinux
>> >> Log:
>> >> Fixed typo from revision 3826.
>> >>
Not a typo. Process substitution: http://wooledge.org:8000/ProcessSubstitution

>> >> Modified: trunk/Scripts/Functions/GoboLinux
>> >>
> ===================================================================
>> >> --- trunk/Scripts/Functions/GoboLinux 2009-01-26 06:25:59 UTC (rev 3858)
>> >> +++ trunk/Scripts/Functions/GoboLinux 2009-02-05 20:05:02 UTC (rev 3859)
>> >> @@ -622,7 +622,7 @@
>> >>     while read path
>> >>     do
>> >>        Programs_To_System_Path "${path}"
>> >> -   done < <(find "${programpath}" -mindepth 2 )
>> >> +   done < $(find "${programpath}" -mindepth 2 )
>> >
>> > Are you sure about that? The former would be equivalent to the version
>> > r3826 replaced (and seems intuitive). Now you're replacing the paths from
>> > every line *inside* all the files.
>>
>> Hmm, I just had a syntax error while that line was being evaluated and
>> I thought that should be the reason (and in fact "StartTask NFSserver"
>> worked after that change). I'll have to look at this later, again.
> <(foo) runs foo in a subshell and creates a real file descriptor for the
> output, and the path to that is substituted on the command line. So `find |
> while read x ... done` is  equivalent to `while read x ... done < <(find)`
> (other than scoping inside the loop). It is a bashism though, so if you're
> using some other shell as /bin/sh and non-SVN BootScripts it could be a parse
> error, since StartTask claimed to work with sh.
>
Yes, process substitution is not portable, so other shells wont work.

> $(find) will be doing something different and probably fails when the argument
> list gets too long. So I think the original was right, but I'm not certain
> until that parse error you hit is resolved one way or the other.
>
The <(find) construct will create a fifo, and therefore handle
arbitrary long results. I don't know how $(find) will work or even if
it *will* work. I'm only guessing here, but I think that that "<
$(find)" will create a list of files and read the contents of everyone
of them, instead of just reading a file list.

-- 
/Jonas
_______________________________________________
gobolinux-devel mailing list
gobolinux-devel@lists.gobolinux.org
http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel

Reply via email to