Skip to content

nc command not found  #3

@mrk-26

Description

@mrk-26

You can modify the script to handle the case when the "nc" command is not found. Replace the following line:

if nc -zw1 google.com 443; then

with:

if command -v nc &>/dev/null && nc -zw1 google.com 443; then

This change checks if the "nc" command is available using the command -v nc &>/dev/null command before attempting to use it. If the command is not found, it will not execute the nc -zw1 google.com 443 part, preventing the "command not found" error.

Make this modification in the script. It should handle the case when the "nc" command is not available and continue execution if there is an internet connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions