Create and Run Bash Scripts with Command Line Arguments
In the lesson, we’ll learn how to encapsulate some logic we want to easily run later in a script. After creating the script, we have to use
chmod u+x to give it execute permissions. If we want our script to make use of parameters passed to it when it's invoked, we can reference them using the syntax
$2, etc. (also known as positional parameters).
We’ll also learn about what
$PATH is, and move our script to a folder already on the
$PATH so that it can be executed in any folder in our shell.