=================================================================
#!/bin/bash
## result file exist check
## if result
TODAY=`date +%Y%m%d%H`
DATE=`date +%Y%m%d_%H:%M:%S`
CPU=`top -n 1 |grep Cpu`
MEM=`top -n 1 |grep Mem`
SWAP=`top -n 1 |grep Swap`
OUT_CPU=CPU_${TODAY}
echo "${DATE} ${CPU}" |tee -a ${OUT_CPU}
=================================================================
위와 같은 스크립트를 실행 할 경우
20190923_16:01:11 Cpu(s): 0.1%us, 0.1%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st