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:
- Output the filename used in
/dev/fd
- Execute the
ls
in>(ls)
Is this right? Why is there a cursor waiting for input?
When you execute
echo >(ls)
, bash replaces this withecho /dev/fd/63
and runsls
with/dev/fd/63
connected to its standard input.echo
does not use its arguments as file names, andls
does not use standard input. Bash will write your standard prompt but the output ofls
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.