Join Scott Simpson for an in-depth discussion in this video Solution: Make a script that generates a system report, part of Learning Bash Scripting.
…My solution to this challenge looks like this.…Your's will probably look different.…And as long as it returns some information…about the system and looks nice, that's just fine.…Let's take a look at the script that I built for this.…Here at the very top I have the shebang…line, and then I start defining a few variables.…The first one is freespace which uses the DF command and a couple options to…get the free space available on the root…volume which is represented by the back slash.…That information is piped into grep with a…simple regular expression to match that line, and then…that's piped into another utility to print out…the specific information that I want to get at.…
After that, I have green text, bold and normal.…Which are three formatting strings that I'll use later on.…And then there's a variable called log date.…That's using the date command to print out the current date.…The four digit year represented by capital Y, the month and the day.…After that, I define variable called log file.…Which concatenates together that log date with _report.log.…
- What is Bash?
- Managing output with grep, awk, and cut
- Understanding Bash script syntax
- Creating a basic Bash script
- Displaying text with "echo"
- Working with numbers, strings, and arrays
- Reading and writing text files
- Working with loops
- Using functions
- Getting user input during execution
- Ensuring a response
Skill Level Beginner
Linux: Bash Shell and Scriptswith Kevin Dankwardt2h 46m Intermediate
1. Working with the Command Line
2. Building Bash Scripts
3. Control Structures
4. Interacting with the User
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.