Shell编程常见问题
常量变量赋值=号前后不留空格,如 PVPN_SERVER=“miniserver”
变量请在$后加花括号
how to get ip address from one line:
myip ="$(ip -o addr | grep global | awk '/^[0-9]/ {print gensub(/(.*)/,"\\1","g",$4)}'|head -1)" IPADDR=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}'|head -1)