Dương Mạnh Cường
New member
How do I use Getopts in bash?
Answer
An example of how to use getopts in bash
Answer
An example of how to use getopts in bash
- getopt here to get the input arguments.
- check that -s exists, if not return an error.
- check that the value after the -s is 45 or 90.
- check that the -p exists and there is an input string after.
- if the user enters ./myscript -h or just ./myscript then display help.