RE: [9fans] A simple rc question - Plan9

This is a discussion on RE: [9fans] A simple rc question - Plan9 ; Duff answered ron's question in “Rc — The Plan 9 Shell”. 12. Command grouping A sequence of commands enclosed in {} may be used anywhere a command is required. For example: {sleep 3600;echo ’Time’’s up!’}& will wait an hour in ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: RE: [9fans] A simple rc question

  1. RE: [9fans] A simple rc question

    Duff answered ron's question in “Rc — The Plan 9 Shell”.

    12. Command grouping

    A sequence of commands enclosed in {} may be used anywhere a command is
    required. For example:

    {sleep 3600;echo ’Time’’s up!’}&

    will wait an hour in the background, then print a message. Without the
    braces,

    sleep 3600;echo ’Time’’s up!’&

    would lock up the terminal for an hour, then print the message in the
    background.

    >===== Original Message From Fans of the OS Plan 9 from Bell Labs

    <9fans@cse.psu.edu> =====
    >> I suspected that and will try it, but the man page is pretty clear (I
    >> thought) that
    >> a|b is a single command. I still think the & should bind to the
    >> pipeline, but ...

    >
    >a PIPE is a cmd, so i'd expect that too.
    >it would also be tedious if
    > cat burp | sed 's/mumble/frog/' | md5sum &
    >ran only the md5sum in the background.


    --
    Benn Newman


  2. Re: [9fans] A simple rc question

    On 5/15/07, Benn Newman wrote:
    > Duff answered ron's question in "Rc The Plan 9 Shell".
    >
    > 12. Command grouping
    >
    > A sequence of commands enclosed in {} may be used anywhere a command is
    > required. For example:
    >
    > {sleep 3600;echo 'Time''s up!'}&
    >
    > will wait an hour in the background, then print a message. Without the
    > braces,
    >
    > sleep 3600;echo 'Time''s up!'&
    >
    > would lock up the terminal for an hour, then print the message in the
    > background.



    it does not really answer the question.
    cmd ; cmd is two commands.
    cmd | cmd is one command.
    cmd ; cmd & will background the second command
    cmd|cmd & should background both.

    Just try this:
    sleep 5|wc

    and then
    sleep 5|wc&

    The | forms the two commands into a compound and the compound is backgrounded.

    That works fine. But in a for it did not. This did work however:
    for(i){{tail -f $i | whatever}&}

    ron

  3. Re: [9fans] A simple rc question

    On Tue, May 15, 2007 at 04:29:45PM -0700, ron minnich wrote:
    > That works fine. But in a for it did not. This did work however:
    > for(i){{tail -f $i | whatever}&}


    The second set of braces is superfluous. The & binds looser than the |,
    and also looser than the for loop. Simply for(i) { tail -f $i | foo & }
    is sufficient.

    --
    Kris Maglione

    Real programmers don't eat quiche. In fact, real
    programmers don't know how to spell quiche. They eat
    twinkies and szechuan food.

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.3 (FreeBSD)

    iD8DBQFGSkPfseQZD8Aui4wRAk+YAJ47BM3ZgW75hYDuf6LsfD QaQ/g4DQCggClE
    IqhsmBPJLqcRzT6H5RZI0SY=
    =mzz1
    -----END PGP SIGNATURE-----


+ Reply to Thread