Artificial intelligent assistant

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?

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

Sure. You can write to a terminal (indeed to any file or pipe or device or socket that supports and authorizes writing) using whatever open file descriptor you have for it. A simpler version of your code would be this:


echo hello >&0


which, as you'd expect, sends "hello\
" to whatever file descriptor 0 points to. If that's your terminal, so be it.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 149d0bf7dd36580df7a89bd487d90f81