
On 13/06/2020 12:24, Per Jessen wrote:
Yes, /dev/tcp is a bash built-in, only works with piping/redirdction.
Oh. man BASH says Bash handles several filenames specially when they are used in redirections, as described in the following table. If the operating system on which bash is running provides these special files, bash will use them; otherwise it will emulate them internally with the behavior described below. /dev/fd/fd If fd is a valid integer, file descriptor fd is duplicated. /dev/stdin File descriptor 0 is duplicated. /dev/stdout File descriptor 1 is duplicated. /dev/stderr File descriptor 2 is duplicated. /dev/tcp/host/port If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open the corresponding TCP socket. /dev/udp/host/port If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open the corresponding UDP socket. Let's see. # ls -l /dev/stdin /dev/stdout /dev/stderr lrwxrwxrwx 1 root root 15 Jun 16 08:25 /dev/stderr -> /proc/self/fd/2 lrwxrwxrwx 1 root root 15 Jun 16 08:25 /dev/stdin -> /proc/self/fd/0 lrwxrwxrwx 1 root root 15 Jun 16 08:25 /dev/stdout -> /proc/self/fd/1 that's what I'd expect :-) # ls -l /dev/fd/ total 0 lrwx------ 1 root root 64 Jun 16 20:51 0 -> /dev/pts/3 lrwx------ 1 root root 64 Jun 16 20:51 1 -> /dev/pts/3 lrwx------ 1 root root 64 Jun 16 20:51 2 -> /dev/pts/3 lr-x------ 1 root root 64 Jun 16 20:51 3 -> /proc/12354/fd Well, yes, default of std{in,out,err} is the terminal # ls -l /dev/tcp /dev/udp # ls -l /dev/tcp /dev/udp ls: cannot access '/dev/tcp': No such file or directory ls: cannot access '/dev/udp': No such file or directory Ah. Redirection in the shell you say. Pitty. -- A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting frowned upon? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org