Ah, yes, that familiar orange glow, the end of another module,
and what a module we've looked at.
We've learned so much about shell scripting using our Bash shell.
We've looked at things such as a file command.
The file command can identify the type of file that we are looking at.
We saw when we had a shell script, we hadn't implemented the shebang,
the file showed it as just an ASCII text file.
But by adding in the shebang, we're adding in the script interpreter,
but that also feeds information back to the file command
indicating that it's a Bash shell script.
We've looked at the echo command where we can print
information back to the screen,
but we've also seen there are switches to this shell built in.
‑N suppresses the new line that would normally be there in each echo statement.
We've seen the read command where we can then gather
user input during the script execution.
We've seen switches like ‑s where we can silent the input so we
don't echo how passwords when they're being entered.
‑P is for our prompt message.
And if we don't specify the variable name,
we're going to be populating a variable called REPLY.
We've implemented for loops, and we've seen within our for loop
that we can have brace expansion. So we can do something like
for i in 1 through to 25, a range.
We've seen our command expansion where we could use then our $ and
parentheses to look at the output of the uname ‑r command in this
instance. We've seen the use of variables, and variables can make our code
more readable by breaking it up into smaller elements and reusing those
elements through the use of variables.
If we have variables just sat in a file such as our os‑release file,
we can use the source command to read those variables into
our current shell or our current script.
We also saw there were different types of loops that we could implement,
not just the for loop. So we looked at while and until. They're really
the same type of structure, but they differ more or less just in whether
we're looking for a negative or a positive. While will continue looping
whilst the condition is true.
Whereas, until will keep on looping until the condition becomes true.
We've seen exit codes and investigated the special variable $?. Remember that?
Remember 0 is indicating the command succeeded, anything
other than 0 then the command failed.
But that's just some of what we've looked at.
But there's an immense amount that you can benefit by going
through this module and making sure you fully understand
everything that you've seen.
Next up though,
we're going to start our journey into looking at implementing
configuration management, such as Puppet and Ansible and infrastructure as code, which can also include things like Terraform.