I would like to make a script that displays all content that is in file2 but is not in file1. Or rather, to erase the contents from file2 that is included in the file1.
Of course, the <(...) only works on Solaris and similar /dev/fd/# flavored LINUX/UNIX, which is a real shame, I love it! You can use named pipe "mknod <path> p" or maybe coshell.
I wonder how bash does that! For ksh users, it comes and goes, and if it was easy to have all the time, I'd think David K would go that way. Using truss/tusc/strace, I see bash is managing named pipes for this (and too many /, no pipe cleanup? -- I just emailed the bash devs and DGK.):
I prefer the <() to the >(), as the latter spawns a background job with job id display and such. I am a big fan of pipeline parallelism, low latency through pipes and no scripted temp files to have name collisions and cleanup.
The named pipe is in the middle, nicer than temp files but demanding pre-creation and, hopefully, cleanup. Also, named pipes can persist with a left over process waiting in vain for a partner. They are more appropriate in a service paradigm.
I can confirm, my /tmp directory here has dozens of sh-np-* files (I'm on version 3.2.16(1))
edit:
Yep found it: you can tell the bash devs in your email if you like:
There are a whole heap of calls to unlink_fifo_list(); in execute_cmd.c that need to have the test defined(HAVE_DEV_FD) changed to !defined(HAVE_DEV_FD)
I referred them here -- why copy when you can point, eh?
Really, they also need to kill what has the pipe open, like:
kill -9 $(fuser pipe_path) 2>/dev/null
That might be more cleanup than the /dev/fd/# versions do, but cleanup is good.
Still, it'd be nice if all UNIX had fd in file tree, as I also get lots of mileage out of /dev/stdin, /dev/stderr and /dev/stdout, to get things back onto pipes or into one log with commands that have their heads in the file-no-pipe sand. I guess you can <(cat) or >(cat), but that is a waste and delay.