Can someone explain to me why I don't see the output of "date" from the below command? For N number for STDIN inputs, it's printing only for last (N-1) commands?

[root@RAJ-RHEL6 raj]# cat < <(date) <(hostname) <(uptime) <(cat /etc/resolv.conf)
 02:22:59 up  2:36,  1 user,  load average: 0.00, 0.00, 0.00
[root@RAJ-RHEL6 raj]#

You may only redirect the standard input stream from one place. You can't expect to be able to redirect it from several files or process substitutions in a single command.

The command

cat < <(date) <(hostname) <(uptime) <(cat /etc/resolv.conf)

is the same as

cat <(hostname) <(uptime) <(cat /etc/resolv.conf) < <(date)

i.e., you are giving cat three input files, and then you redirect the output of date into its standard input.

The cat utility will not use its standard input stream if it's given files to work with, but you can get it to do so by using the special - filename:

cat - <(hostname) <(uptime) <(cat /etc/resolv.conf) < <(date)

Note also that the last process substitution is useless and the command is better written written as

cat - <(hostname) <(uptime) /etc/resolv.conf < <(date)

or, without that redirection of the output of date, as

cat <(date) <(hostname) <(uptime) /etc/resolv.conf

or, with a single command substitution,

cat <( date; hostname; uptime; cat /etc/resolv.conf )

or, without process substitutions,

date; hostname; uptime; cat /etc/resolv.conf


  • drat !! fastest gun in the web again !! congrat ! – Archemar Jul 15 '19 at 7:06

as per man cat

Concatenate FILE(s) to standard output.

With no FILE, or when FILE is -, read standard input.

thus if you give FILE, standard input is not read.

this is not a bash feature, it also work (or don't work) with plain files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.