Comment

Comment by gricardo99

I'm not sure if the code example changed on the linked page after your comment, but I see this code:

  #!/bin/bash
  if exec 3>/dev/tcp/localhost/4000 ; then
 echo "server up!"
  else
 echo "server down."
  fi
Which also confused me for similar reasons to your comment. I'm not familiar with exec, but generally non-zero return means a fail, and zero means success. So why is the "server up" for non-zero result?
parent gricardo99 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton