其他分享
首页 > 其他分享> > 测试

测试

作者:互联网

#!/bin/bash                                                                                                                                                                       
  
echo -e "\033[0;32m
  _    _  ____   _____ _______ 
| |  | |/ __ \ / ____|__   __|
| |__| | |  | | (___    | |   
|  __  | |  | |\___ \   | |   
| |  | | |__| |____) |  | |   
|_|  |_|\____/|_____/   |_| by haha\033[0m"

# os
upSeconds="$(cut -d. -f1 /proc/uptime)"
secs=$((${upSeconds}%60))
mins=$((${upSeconds}/60%60))
hours=$((${upSeconds}/3600%24))
days=$((${upSeconds}/86400))
UPTIME_INFO=$(printf "%d days, %02dh %02dm %02ds" "$days" "$hours" "$mins" "$secs")

if [ -f /etc/redhat-release ] ; then
    PRETTY_NAME=$(< /etc/redhat-release)

elif [ -f /etc/debian_version ]; then
   DIST_VER=$(</etc/debian_version)
   PRETTY_NAME="$(grep PRETTY_NAME /etc/os-release | sed -e 's/PRETTY_NAME=//g' -e  's/"//g') ($DIST_VER)"

else
    PRETTY_NAME=$(cat /etc/*-release | grep "PRETTY_NAME" | sed -e 's/PRETTY_NAME=//g' -e 's/"//g')
fi

if [[ -d "/system/app/" && -d "/system/priv-app" ]]; then
    model="$(getprop ro.product.brand) $(getprop ro.product.model)"

elif [[ -f /sys/devices/virtual/dmi/id/product_name ||
        -f /sys/devices/virtual/dmi/id/product_version ]]; then
    model="$(< /sys/devices/virtual/dmi/id/product_name)"
    model+=" $(< /sys/devices/virtual/dmi/id/product_version)"

elif [[ -f /sys/firmware/devicetree/base/model ]]; then
    model="$(< /sys/firmware/devicetree/base/model)"

elif [[ -f /tmp/sysinfo/model ]]; then
    model="$(< /tmp/sysinfo/model)"
fi



标签:__,redhat,days,____,etc,测试,upSeconds
来源: https://www.cnblogs.com/acommoners/p/15881964.html