Here is an example of Bash's process substitution:
zjhui@ubuntu:~/Desktop$ echo >(ls)
/dev/fd/63
zjhui@ubuntu:~/Desktop$ abs-guide.pdf
Then I get a cursor waiting for a command.
/dev/fd/63
doesn't exist. I think what happens is:
/dev/fd
ls
in >(ls)
Is this right? Why is there a cursor waiting for input?
When you execute echo >(ls)
, bash replaces this with echo /dev/fd/63
and runs ls
with /dev/fd/63
connected to its standard input. echo
does not use its arguments as file names, and ls
does not use standard input. Bash will write your standard prompt but the output of ls
comes after it. You can type in any Bash command there, you just lost the visual cue from the prompt, which is further up the screen.
echo >(ls)
is not something that is likely to ever be useful.