Skip to main content
That markup was bad.
Source Link
JdeBP
  • 72.1k
  • 13
  • 175
  • 381

Can I Duplicateduplicate an input file descriptor and use it for writing data?

The below command makes a copy of the input file descriptor and use the duplicate file descriptor for writing data from the echo command on to the console.

sh-4.2$ exec 6<&0
sh-4 The below command makes a copy of the input file descriptor and use the duplicate file descriptor for writing data from the echo command on to the terminal.2$ echo "hello" >&6
hello

 sh-4.2$ exec 6<&0 sh-4.2$ echo "hello" >&6 hello 

Does that mean we can write to the console using the input file descriptor? Does that mean we can write to the terminal using the input file descriptor?

Can I Duplicate an input file descriptor and use it for writing data

The below command makes a copy of the input file descriptor and use the duplicate file descriptor for writing data from the echo command on to the console.

sh-4.2$ exec 6<&0
sh-4.2$ echo "hello" >&6
hello

Does that mean we can write to the console using the input file descriptor?

Can I duplicate an input file descriptor and use it for writing data?

The below command makes a copy of the input file descriptor and use the duplicate file descriptor for writing data from the echo command on to the terminal.

 sh-4.2$ exec 6<&0 sh-4.2$ echo "hello" >&6 hello 

Does that mean we can write to the terminal using the input file descriptor?

Source Link

Can I Duplicate an input file descriptor and use it for writing data

The below command makes a copy of the input file descriptor and use the duplicate file descriptor for writing data from the echo command on to the console.

sh-4.2$ exec 6<&0
sh-4.2$ echo "hello" >&6
hello

Does that mean we can write to the console using the input file descriptor?