Hands-on task
This task is step 5 of the course “Networking and HTTP from the terminal”
bash /dev/tcp: check a port
Write a script /root/portcheck.sh: it takes a port number and prints open if that TCP port on localhost is open, and closed otherwise. Check it with bash itself, without nc/telnet/curl/ss. Then use it to check port 8000 and write the result to /root/status.txt.
Reference:Exit codes
What you'll practise:
- bash
- /dev/tcp
- port check
- exit codes
- subshell