#!/bin/bash
os_system(){
##系统信息
os_type=
(
u
n
a
m
e
)
e
c
h
o
"
操
作
系
统
的
类
型
:
(uname) echo "操作系统的类型 :
(uname)echo"操作系统的类型:{os_type}"
##系统信息
os_ver=
(
c
a
t
/
e
t
c
/
r
e
d
h
a
t
−
r
e
l
e
a
s
e
)
e
c
h
o
"
操
作
系
统
的
类
型
:
(cat /etc/redhat-release) echo "操作系统的类型 :
(cat/etc/redhat−release)echo"操作系统的类型:{os_ver}"
os_ker= ( u n a m e − r ) e c h o " 操 作 系 统 的 版 本 信 息 : (uname -r) echo "操作系统的版本信息 : (uname−r)echo"操作系统的版本信息:{os_ker}"
os_time= ( d a t e + e c h o " 服 务 器 当 前 时 间 : (date +%F_%T) echo "服务器当前时间: (date+echo"服务器当前时间:{os_time}"
os_last_reboot=$(uptime |awk ‘{print $3,$4}’|awk -F ‘,’ '{print KaTeX parse error: Expected 'EOF', got '}' at position 2: 1}̲') echo "服务器最后重…{os_last_reboot}"
os_hostname=
(
h
o
s
t
n
a
m
e
)
e
c
h
o
"
服
务
器
主
机
名
称
:
(hostname) echo "服务器主机名称:
(hostname)echo"服务器主机名称:{os_hostname}"
}
while :
do
os_system
done