HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

<> — Open a file descriptor for read and write. More information: <https://www.gnu.org/software/bash/manu

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandreadclifileopendescriptorfor<>

Problem

How to use the <> command: Open a file descriptor for read and write. More information: <https://www.gnu.org/software/bash/manual/bash.html#Opening-File-Descriptors-for-Reading-and-Writing>.

Solution

<> — Open a file descriptor for read and write. More information: <https://www.gnu.org/software/bash/manual/bash.html#Opening-File-Descriptors-for-Reading-and-Writing>.

Open a file in a file descriptor for read and write:
exec {{3}}<>{{path/to/file}}


Open a file descriptor to a remote connection:
exec {{3}}<>/dev/{{tcp}}/{{remote_host}}/{{port_number}}


Close a file descriptor:
exec {{3}}<>-

Code Snippets

Open a file in a file descriptor for read and write

exec {{3}}<>{{path/to/file}}

Open a file descriptor to a remote connection

exec {{3}}<>/dev/{{tcp}}/{{remote_host}}/{{port_number}}

Close a file descriptor

exec {{3}}<>-

Context

tldr-pages: common/<>

Revisions (0)

No revisions yet.