From a0130db5cb26c4ce3ce7d8907ffbf7ee0f51f2cf Mon Sep 17 00:00:00 2001 From: metalGod Date: Sat, 29 Dec 2018 18:15:27 +0000 Subject: [PATCH] wrote few changes in the script --- 1_answer.sh | 13 ++++++++----- 29-Dec-2018_report.log | 3 +++ 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 29-Dec-2018_report.log diff --git a/1_answer.sh b/1_answer.sh index 91e7d6f..6132092 100644 --- a/1_answer.sh +++ b/1_answer.sh @@ -2,7 +2,7 @@ # writing few things that I learned diskspace=$(sudo du -sh) -usedspace=$(df -l | grep rootfs | awk '{print $5}') +avaispace=$(df -h | grep rootfs | awk '{print $4}') cdate=$(date +"%d-%h-%Y") ctime=$(date +"%I:%M") yellow=$(tput setab 0; tput setaf 3; tput bold) @@ -10,15 +10,18 @@ none=$(tput sgr0) hostname=$(hostname) host=$(uname --all | awk '{print $1}') log="$cdate"_report.log -printf -v info "\t\tToday's Date is:\t\t\t$yellow%s$none\n\t\tThe Time is:\t\t\t\t$yellow%s$none" $cdate $ctime +echo "Writing small script to find information from this $host machine called $hostname" +printf -v info "\n\t\tToday's Date is:\t\t\t$yellow%s$none\n\t\tThe Time is:\t\t\t\t$yellow%s$none" $cdate $ctime echo "$info" -printf -v system "\t\tThe hostame is:\t\t\t\t$yellow%s$none\n\t\tThe System is:\t\t\t\t$yellow%s$none" $hostname $host +printf -v system "\t\tThe hostame is:\t\t\t\t$yellow%s$none\n\t\tThe System is:\t\t\t\t$yellow%s\n$none" $hostname $host echo "$system" -echo "The total used up space is $yellow$usedspace$none and current directory space used is $yellow$diskspace$none" +echo "The total remaining space $yellow$avaispace$none and current directory space used is $yellow$diskspace$none" echo -e $yellow"The log file has been saved at $log"$none cat << endofline Doing my Excersise one in bash. endofline -printf "Hostname:\t%s\n" $hostname >> $log +printf "Hostname:\t%s\n" $hostname > $log printf "System:\t\t%s\n" $host >> $log +printf "Disk Avai:\t%s\n" $avaispace >> $log + diff --git a/29-Dec-2018_report.log b/29-Dec-2018_report.log new file mode 100644 index 0000000..9e7a447 --- /dev/null +++ b/29-Dec-2018_report.log @@ -0,0 +1,3 @@ +Hostname: VirusKiller +System: Linux +Disk Avai: 58G