1、显示系统信息脚本

#!/bin/bash
#A system information gathering script
#Command
UNAME="uname -a"
printf "Gathering system information with the $UNAME command:\n\n"
$UNAME #Command
DISKSPACE="df -h"
printf "Gathering diskspace information with the $DISKSPACE command: \n\n"
$DISKSPACE
~

以上实例运行结果:

$ sh test4.sh
Gathering system information with the uname -a command: Linux gio016 2.6.-431.29..lustre.el6.x86_64 # SMP Fri Jul :: CST 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 % /
tmpfs 32G 32G % /dev/shm
/dev/sda1 485M 142M 318M % /boot
/dev/memdiska .1T 132G 914G % /home/export/tmp
17.0.1.3@o2ib:17.0.1.4@o2ib:/gswgfs
.3P 988T .2P % /home/export/online1
10.0.0.206:/vol/vol_user_home
.8T .3G .8T % /home/export/base
05-11 22:27