Bash – Return Date, Users, Disk, and Memory to Text File

email me

#!/bin/sh
_now=$(date +"%Y_%m_%d_%H_%M_%S")
users='compgen -u'
dsk=df
mem='vm_stat'
filename=sysdata_$_now.txt

date > $filename
echo '\n' >> $filename
echo '\n' >> $filename
$users >> $filename
echo '\n' >> $filename
echo '\n' >> $filename
$dsk >> $filename
echo '\n' >> $filename
echo '\n' >> $filename
$mem >> $filename