Writing a script to display system information
For our convenience, let’s create a directory to store our shell scripts:
And open a new text file named
system_info.sh
with your preferred text editor. We will begin by inserting a few comments at the top and some commands afterwards:
Next, give the script execute permissions:
and run it:
Note that the headers of each section are shown in color for better visualization:
That functionality is provided by this command:
Where COLOR1 and COLOR2 are the foreground and background colors, respectively (more info and options are explained in this entry from the Arch Linux Wiki) and <YOUR TEXT HERE> is the string that you want to show in color.
0 Comments
Post a Comment