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 $1
, $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.
Nice! What other bash scripts are usfeul for devs?
Nice! What other bash scripts are usfeul for devs?
The possibilities are endless! For example: https://gist.github.com/ccnokes/af3a1fe7434e284650693787f99d4e1c or https://gist.github.com/ccnokes/2562c9d25a84ec7f4e0b7137aca7ede0 are just recent examples I came across.