#!/bin/bash
COMMANDS=(dmesg
"cat /proc/asconf_info" "cat /proc/cpuinfo"
"cat /proc/meminfo" free mount df "apt-get moo"
)
function info {
echo
echo "$user@$host:>$*"
$*
}
user=`who | awk '{print $1}'`
host=`hostname`
uname -a
i=0
while [ $i -lt ${#COMMANDS[*]} ]; do
cmd=${COMMANDS[$i]}
#if cat then check file is exist
if [ "${cmd:0:3}" = "cat" ]; then
if [ -e ${cmd:4} ]; then
info $cmd
fi
else
info $cmd
fi
let i=i+1
done
沒有留言:
張貼留言