Le primidi 1er fructidor, an CCXXIV, Clement Boesch a écrit : > maybe these files should be in /tmp > > i'd also suggest > > TMPFILES="murge.theirs murge.common murge.ours murge.X" > trap 'rm -f -- $TMPFILES' EXIT > > (stolen from configure)
Temporary files are annoying and tricky (and configure does not clean up when it is interrupted). I suggest to require a more advanced shell (bash or zsh; since this tool is meant for developers it is acceptable) and use process substitution: diff <(grep ...) <(grep ...) It starts both grep processes just like "grep | diff", but then, instead of connecting the other end of the pipe to diff's standard input, it gives it the corresponding file name as /dev/fd/42. If temp files are really necessary because the command does not work with pipes, then zsh's process substitution can serve: diff =(grep ...) =(grep ...) It does the same as <(grep) but with a temp file instead of a pipe; zsh does all the cleanup for us. Last of all, if temp files are necessary because the output needs to be processed several times, zsh's process substitution can still be abused: function do_the_work { grep > $1 grep > $2 grep > $3 diff $1 $2 diff $2 $3 } do_the_work =(:) =(:) =(:) The strange smileys are just process substitution with a dummy command. Therefore, it starts the function with three temp files. They are all empty, because the dummy command does not produce output, but they can then be used in the function. Regards, -- Nicolas George
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel