Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Bash does thing I never suspected.

Try this and be amazed:

$ cat < /dev/tcp/gsmtp163.google.com/25
220 mx.google.com ESMTP 12si345086nzn

Be hon­est: did you know bash could do that? I did­n't un­til find­ing it in the man page

Now try this and be amazed it does­n't work (yes, it's in the doc­s):

$ cat /dev/tcp/gsmtp163.google.com/25
cat: /dev/tcp/gsmtp163.google.com/25: No such file or directory

And re­mem­ber, on unix ev­ery­thing is a file, but maybe that file is on­ly there in some very spe­cif­ic cir­cun­stances.

UP­DATE: There is a chance this will not work in your dis­tro, specif­i­cal­ly De­bian.

It's broken / 2007-11-15 21:18:

This doesn't work for me - I get "no such file or directory". Have I missed something?

Nathan Myers / 2007-11-15 21:47:

Doesn't work for me. "man bash" reports

"NOTE: Bash, as packaged for Debian, does not support using the /dev/tcp and /dev/udp files."

Roberto Alsina / 2007-11-15 22:08:

Well, that explains it. It works here :-)

Will update it to show the output and mention this.


Contents © 2000-2024 Roberto Alsina