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

Re: input redirect from a variable



On Sep 23, 12:15pm, Mikael Magnusson wrote:
}
} > foo1="$(...)"
} > foo2="$(...)"
} >
} > comm -3 <<<<$foo1 <<<<$foo2
} 
} comm -3 <(echo "$foo1") <(echo "$foo2")
} but that seems stupid :)

Incidentally:

    comm -3 =(<<<$foo1) =(<<<$foo2)

There already is a <<< syntax, but it turns a string into standard input
as a "here document".  Wrapping that in =(...) causes zsh to read that
input and put it in the temp file.

A nice optimization (which has not yet been done) would be to have this
special case avoid forking a new process, much as $(<file) reads a file.
Right now =(<<<...) is equivalent to =($NULLCMD <<<...).  Which actually
seems like a bug to me; shouldn't it use $READNULLCMD instead?  (Not that
one really wants "more" rather than "cat" inside a substitution, but even
outside of substitutions, here-documents are fed to $NULLCMD rather than
to $READNULLCMD.)



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