Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: virtual files?



On Apr 21,  4:12am, Emanuel Berg wrote:
} 
} What is the colon in =(:) - an "anonymous function
} qualifier"?

The syntax =(command) runs command and captures its output in a temp
file, then substitutes the name of the temp file; the file itself is
removed as soon as the current command finishes.  So

    echo =(echo foo)

will print something like /tmp/zshhKNk2F and

    cat =(echo foo)

will print foo.

Thus

    () { cat $1 } =(echo foo)

also prints foo.  The ":" command is just a quick built-in no-op that
produces no output, so that the temporary file created by =(:) will
be empty.



Messages sorted by: Reverse Date, Date, Thread, Author