Skip to content

Commit

Permalink
wrote few changes in the script
Browse files Browse the repository at this point in the history
  • Loading branch information
metalaarif committed Dec 29, 2018
1 parent ff4127f commit a0130db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 8 additions & 5 deletions 1_answer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@
# 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)
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

3 changes: 3 additions & 0 deletions 29-Dec-2018_report.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Hostname: VirusKiller
System: Linux
Disk Avai: 58G

0 comments on commit a0130db

Please sign in to comment.