QingKeZhiXia
8/3/2019 - 6:35 AM

Linux interesting shell

# 获取指定网卡的 ip4 地址

echo $(ifconfig eth0 | grep inet | awk '{print $2}')
#!/bin/bash

# 得到系统的版本的名称
function get_os_name() {
    if [[ "$(uname -s)" == "Darwin" ]]; then
        echo "mac"
        return 0
    fi
    
    if [[ -f /etc/os-release ]]; then
        source /etc/os-release
    else
        return 1
    fi

    echo $ID
    return 0
}