I am using Cygwin - no, don't close yet - and I am having trouble with the <()
syntax. A program refuses to accept the file descriptor that I am passing it, but other programs will accept it fine. My hypothesis is that the program is passing the file descriptor to one of its helper programs, which then does not receive the pipe (just the usual 0
, 1
and 2
, of which 0
and 2
are probably closed). This works fine with cat
, just not with this program.
MCVE:
./jpegtran -copy all -drop +16+16 <(echo "JPEG FILE") -outfile out.jpeg out.jpeg
This produces the error message:
C:\path\to\jpegtran.exe: can't open /dev/fd/63 for reading
Is there a way to do this? Or will I have to resort to... temporary files? *shudder*
As far as I know, Cygwin simulates a POSIX environment for all intents and purposes. If it can't create a pseudo-file using named pipes (something I know is possible using the Windows API under //./pipe/pipename
, which should be able to be handled using whatever name-rewriting is currently being used for when I pass a Windows program a /cygdrive/c/
path) then I'm happy with answers that will work on an actual 'nix box.
echo <(echo "JPEG")
and the output. That will show the filename. – hschou Nov 13 '17 at 20:34/proc/63
or something like that - the same as on Debian. – wizzwizz4 Nov 13 '17 at 22:19/dev/stdin
has the same issue, with an identical error message. – wizzwizz4 Nov 13 '17 at 22:21out.jpeg
twice in your command...typo presumably...? So what does "refuse to accept" mean? Is there an error message? – B Layer Nov 13 '17 at 22:39jpegtran
manpage (for Cygwin) doesn't indicate that you can pass it all those files. It says "reads the named JPEG/JFIF file, or the standard input if no file is named, and produces a JPEG/JFIF file on the standard output." Source code indicates same: it accepts 0 or 1 filename. Are you using a standard build here? – B Layer Nov 13 '17 at 22:50jpegtran
to add other images to the output file in a for loop. – wizzwizz4 Nov 14 '17 at 16:42./jpegtran -copy all -drop +16+16 <(echo "JPEG FILE") > out.jpeg
(assuming process substitution works with jpegtran...which is not guaranteed). – B Layer Nov 14 '17 at 19:55-drop
. The next is the one to write to. The next is the one to drop onto. I think this is right. – wizzwizz4 Nov 15 '17 at 19:11./jpegtran -copy all -drop +16+16 A -outfile B C
, C is the file to open, A is the file given as the input to the-drop
"tool" and B is the file to write to. – wizzwizz4 Nov 15 '17 at 19:13