每天写点shell脚本 (持续更新)

1、显示系统信息脚本

#!/bin/bash
#A system information gathering script
#Command 1
UNAME="uname -a"
printf "Gathering system information with the $UNAME command:

"
$UNAME

#Command 2
DISKSPACE="df -h"
printf "Gathering diskspace information with the $DISKSPACE command: 

"
$DISKSPACE
~           

 以上实例运行结果:

$ sh test4.sh
Gathering system information with the uname -a command:

Linux gio016 2.6.32-431.29.2.lustre.el6.x86_64 #1 SMP Fri Jul 31 09:39:58 CST 2015 x86_64 x86_64 x86_64 GNU/Linux
Gathering diskspace information with the df -h command: 

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             258G  100G  146G  41% /
tmpfs                  32G     0   32G   0% /dev/shm
/dev/sda1             485M  142M  318M  31% /boot
/dev/memdiska         1.1T  132G  914G  13% /home/export/tmp
17.0.1.3@o2ib:17.0.1.4@o2ib:/gswgfs
                      3.3P  988T  2.2P  32% /home/export/online1
10.0.0.206:/vol/vol_user_home
                      2.8T  6.3G  2.8T   1% /home/export/base
原文地址:https://www.cnblogs.com/wangtao1993/p/6501354.html