July 2018
Beginner
264 pages
8h 9m
English
Retrieving program input parameters or arguments is very similar to function parameters at the most basic level. They can be accessed in the same fashion as $1 (arg1), $2 (arg2), $3 (arg3), and so on. However, so far, we have seen a concept called flags, which allows you to perform neat things such as-l, --long-version, -v 10, --verbosity=10. Flags are effectively a user-friendly way to pass parameters or arguments to a program at runtime. For example:
bash myProgram.sh -v 99 --name=Ron -l Brash
Now that you know what flags are and how they can be helpful to improve your script, use the following section as a template.
Read now
Unlock full access