Created
August 15, 2022 21:10
-
-
Save solrevdev/6060bb2f0568b3e85101e72a9b4f1a97 to your computer and use it in GitHub Desktop.
Runs apt-get update, upgrade and autoremove commands with elapsed time written to console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # store the current date into a variable called startTime | |
| startTime=$(date +"%s") | |
| echo "Start time: $(date)" | |
| sudo apt-get update && sudo apt-get upgrade -y | |
| sudo apt-get autoremove -y | |
| finishTime=$(date +"%s") | |
| echo "End time: $(date)" | |
| # write out how long script took to run | |
| diff=$(($finishTime-$startTime)) | |
| echo "$(($diff / 3600)) hours, $((($diff / 60) % 60)) minutes and $(($diff % 60)) seconds elapsed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment