Skip to main content
added 156 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

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

Related:

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

Related:

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

Related:

Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

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

Related: