2

I am looking for a way to open TCP connections in fish shell.

In bash, I can do the following to open a TCP connection. This is quick telnet type test when telnet is not installed.

$ echo > /dev/tcp/127.0.0.1/80  && echo up
up

A failed connection

aaron@aaron-pc: ~ 
$ echo > /dev/tcp/127.0.0.1/81  && echo up
bash: connect: Connection refused
bash: /dev/tcp/127.0.0.1/81: Connection refused

In fish I tried the following.

echo > /dev/tcp/127.0.0.1/80; and echo up
An error occurred while redirecting file '/dev/tcp/127.0.0.1/80'
open: No such file or directory

I guess the bash has that functionality to create a tcp device when it needs it and fish uses some other mechanism.

Here is some of the documentation on bash and /dev/tcp https://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip https://stackoverflow.com/a/19866239/619760

1 Answer 1

2

fish does not do this. You will need to use netcat or a tool designed for network connections, or use an operating system which provides file-level access to remote network endpoints (such as GNU Hurd's socketio translator).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .