Here is the video version, if you prefer it:
In our script, we have tested if our first argument equals a certain string, that is:
[ "$1" = 'Hello' ]
there are other tests as well. You can test files (for example, if a file is a regular file), integers and strings. I won’t cover that here and will leave you this resource to look at if you want to learn more about these tests: (“Chapter 7. Tests,” n.d.) Relevant sections are 7.2 and 7.3.
But remember, no matter what test you are using, the gist of it is: “If this is true (if the exit code is 0) then do this, if not, do the other thing”.
Hope you learned something useful!
References
Chapter 7. Tests. (n.d.). Retrieved February 22, 2020, from https://www.tldp.org/LDP/abs/html/tests.html. Sections 7.2 and 7.3
Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.