bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No such device or address when opening /dev/fd/<x> on opened /dev/tcp so


From: konsolebox
Subject: No such device or address when opening /dev/fd/<x> on opened /dev/tcp socket
Date: Tue, 6 Apr 2021 01:31:47 +0800

Not sure if this is a bug or a limitation but this works:

# echo a | ( exec {fd}>/path/to/regular/file; tee /dev/fd/"$fd" )

While this produces a "No such device or address" error:

# echo a | ( exec {fd}>/dev/tcp/host/port; tee /dev/fd/"$fd" )

Simpler forms like this does the same:

# echo a | tee /dev/fd/4 4>/dev/tcp/host/port
# echo a | ( tee /dev/fd/4 ) 4>/dev/tcp/host/port

The workaround is to use process substitution and cat:

# echo a | tee >( cat > /dev/tcp/host/port )

Tested in 5.1.4.

-- 
konsolebox



reply via email to

[Prev in Thread] Current Thread [Next in Thread]