Some programs needs their files to be seekable, for example objdump
does.
$ objdump -D -b binary -m i8086 <(echo 0xea 0x5b 0xe0 0x00 0xf0|xxd -r -p)
objdump: Warning: '/proc/self/fd/11' is not an ordinary file
It would be convenient to have process substitution use temporary files.
I can see in the man page that bash can fallback to temporary files with process substitution, but can I explicitly ask him to use temporary files?
Like zsh
's =()
.
$ objdump -D -b binary -m i8086 =(echo 0xea 0x5b 0xe0 0x00 0xf0|xxd -r -p)
/tmp/zsh1u1Nrw: file format binary
Disassembly of section .data:
00000000 <.data>:
0: ea 5b e0 00 f0 ljmp $0xf000,$0xe05b
mktemp
. – Wildcard Mar 14 '16 at 07:48bash
withHAVE_DEV_FD
set to0
. – cuonglm Mar 14 '16 at 07:54foo >/tmp/xxx;cmd /tmp/xx;rm /tmp/xxx
It's not about bash programming, for which there are better solutiosn, but about one off one-line scripts. – Elazar Leibovich Mar 14 '16 at 08:16objdump -D -b binary -m i8086 /dev/stdin <<<$(echo 0xea 0x5b 0xe0 0x00 0xf0|xxd -r -p)
– meuh Mar 14 '16 at 08:40mkfifo
andmktemp
. – Wildcard Mar 14 '16 at 08:49cmd >x;cmd2 x;rm x
, and I don't see the difference – Elazar Leibovich Mar 14 '16 at 11:02objdump
, that's the whole point of the question. Otherwise<()
was good enough. – Elazar Leibovich Mar 14 '16 at 21:40touch
instead ofmkfifo
. (Just doing that change by itself would probably be enough.) – Wildcard Mar 14 '16 at 21:55cmd >x;objdump x;rm x
is the best approach, mktemp is not really needed. I wanted a solution that is convenient for one off scripts. – Elazar Leibovich Mar 15 '16 at 08:02