It's such a small thing, but I really enjoyed being privy to this question and discussion today.

On 14/12/2021 17:21, Daniel Shahaf wrote:
אורי wrote on Tue, 14 Dec 2021 07:44 +00:00:
Actually I prefer the "<(..)" method, because sometimes I want to compare 2
commands:

diff <(pip freeze | sort) <(cat requirements.txt | sort)


Consider s/diff/comm -12/.

Or even use cat and echo to add a specific line to one of the outputs. If I
want the result to be completely null. For example to run in crontab and
send me mail whether it's not null.

Careful here.  By default, cron jobs run not under your login shell but
under /bin/sh, and it's possible the latter doesn't support «<(…)» even
if the former does.

Out of curiosity I asked the internet: https://unix.stackexchange.com/questions/159513/what-are-the-shells-control-and-redirection-operators

Looks like < as a redirect is POSIX-compliant, but as soon as it's <(...) it's not a redirect anymore but instead a process substitution which is implemented in BASH, ZSH, etc.:
https://www.gnu.org/software/bash/manual/bash.html#Process-Substitution
https://zsh.sourceforge.io/Intro/intro_7.html

Nice to learn a new trick - I probably would have just redirected to a temp file instead of the compact solution discussed today.

Cheers,

Daniel


אורי
u...@speedy.net


On Tue, Dec 14, 2021 at 9:31 AM Eli Marmor <e...@netmask.it> wrote:

Use "-" instead the file name of one of both of the files, and pipe your
output to the diff command.

‪On Tue, 14 Dec 2021 at 09:12, ‫אורי‬‎ <u...@speedy.net> wrote:‬

Thank you.

אורי
u...@speedy.net
_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il



_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Mark E. Fuller, Ph.D.
HaShikma 19, Apt. 24
Nesher 3681219, Israel
+972 (0)53-872-6579
+49 (0)1577 1848188
+1 401-214-4266
mark.e.ful...@gmail.com
mark.e.ful...@gmx.de
ful...@stossrohr.net
@fuller:one.ems.host
https://www.stossrohr.net
PGP Fingerprint: 73F1 A30C BDF4 DB4B C75F FD0F D599 E76C FFCA BF60

_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

Reply via email to