How do I use Getopts in bash?

How do I use Getopts in bash?
Answer
An example of how to use getopts in bash
  1. getopt here to get the input arguments.
  2. check that -s exists, if not return an error.
  3. check that the value after the -s is 45 or 90.
  4. check that the -p exists and there is an input string after.
  5. if the user enters ./myscript -h or just ./myscript then display help.
 

Tìm kiếm

Back
Top