howto:getopts_tutorial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
howto:getopts_tutorial [2018/03/20 22:58]
ffox8 [Description] stop contradicting oneself about professinalism
howto:getopts_tutorial [2018/03/20 23:00]
ffox8 [Description] reword
Line 4: Line 4:
  
 ===== Description ===== ===== Description =====
-**Note that** ''​getopts''​ is not able to parse GNU-style long options (''<​nowiki>​--</​nowiki>​myoption''​) ​or XF86-style long options (''​-myoption''​) ​- so, when you want to parse command line arguments in a real "professional" ​way, ''​getopts''​ may or may not work for you. Unlike its older brother ''​getopt''​ (note the missing //s//!), it's a shell builtin command. The advantages are:+**Note that** ''​getopts''​ is neither ​able to parse GNU-style long options (''<​nowiki>​--</​nowiki>​myoption''​) ​nor XF86-style long options (''​-myoption''​). So, when you want to parse command line arguments in a professional ​;-) way, ''​getopts''​ may or may not work for you. Unlike its older brother ''​getopt''​ (note the missing //s//!), it's a shell builtin command. The advantages are:
   * No need to pass the positional parameters through to an external program.   * No need to pass the positional parameters through to an external program.
   * Being a builtin, ''​getopts''​ can set shell variables to use for parsing (impossible for an //​external//​ process!)   * Being a builtin, ''​getopts''​ can set shell variables to use for parsing (impossible for an //​external//​ process!)
  • howto/getopts_tutorial.txt
  • Last modified: 2018/03/21 00:07
  • by ffox8