On Sat, Oct 21, 2000 at 08:23:44AM +0200, Shaul Karl wrote:
> > Also, seems that not many people are aware of "process substitution"
> > in bash: you do something like "diff <(ls dir1) <(ls dir2)", and bash
> > runs two ls's, each writing to a FIFO, and diff gets the names of
> > these two FIFOs as parameters. Output redirection also works. I'm not
> > sure how portable it is, though.
>
> 1.
> [08:05:37 /tmp]$ diff < (ls ~/setiathome/) <(ls ~/setiathome/amos/)
> bash: syntax error near unexpected token `(l'
> [08:06:04 /tmp]$
>
> Ache, the space there is significant:
>
> [08:17:12 /tmp]$ diff <(ls ~/setiathome/) <(ls ~/setiathome/amos/)
Yeah... Otherwise it's redirection.
> 2.
> This will only work if the "main" process (diff in this example) does not need
> to seek the input since it can not do it with a FIFO. Or am I missing
> something?
True... You can't. It would've been nice if Bash had the option to use
temporary files rather than FIFOs... But I don't know if it's needed
that often.
Just tried: both nvi and vim cope fine, Emacs refuses to read it (at
least with default setup and switches). Less requires you to use -f.
- Adi Stav
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]