[arch-general] Start a daemon, show a syntax error

Sebastian Schwarz seschwar at googlemail.com
Fri Feb 17 11:07:41 EST 2012


On 2012-02-17 at 12:03 +0100, Lukas Fleischer wrote:
> "done < $(foo)" isn't the same thing as "done < <(foo)".

Just out of curiosity: in unmount_all() in /etc/rc.d/functions
this is used:

    while read -r target fstype options; do
        ...
    done < <(findmnt -mrunRo TARGET,FSTYPE,OPTIONS /)

But why not simply use a pipe in this case:

    findmnt -mrunRo TARGET,FSTYPE,OPTIONS / \
            | while read -r target fstype options; do
        ...
    done

This should do the same and would be more idiomatic.  The commit
message[1] when this was introduced did not say anything about
that.

I wonder what might be the reason for this, understand it and
thus improve my shell scripting skills. :)

Thanks,
Sebastian

[1]: http://projects.archlinux.org/initscripts.git/commit/?id=34714bf34e5928479e5ec4367e5e79902876dfa3


More information about the arch-general mailing list