Get the App
SLTechnology News&Howtos  ›  Network Security  › 

The script that automatically obtains the public network ip

Shulou Source: shulou.com Published: 2022-06-01 04:53:42 10月04日 Update

I casually wrote a script to obtain the public network IP, which mainly distinguishes the difference between "" and ``.

#! / bin/baship_add= `curl-s-4 icanhazip.com `echo "public IP:$ip_add"

The above assignment "" in / bin/bash takes a string, while ``is the string after the instruction is run. Of course, it can also be applied to some scripts such as iptables,DNS on this basis.

Tags: Script character string public network foundation instruction run Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Tech Info Huawei Apple Docker