[Bash scripting #1] Parsing options with getopt
Автор: Mindful Technology
Загружено: 2024-03-29
Просмотров: 396
0:00 Intro
0:47 An overview of the template script
1:11 The script's version
1:33 The getopt version check
2:16 The script's help message
2:53 The running getopt part
3:34 Re-setting the positional arguments
5:37 The defaults and the config file
7:15 The config file
10:09 The parsing loop
12:31 The advantage of parsing out all of the optional arguments
16:54 The error message in case you forgot to add an option to the parsing loop
18:01 A more detailed look
18:21 The demo script
20:19 The initial arguments
21:08 The value of opts
22:19 What happens when you run getopt
25:06 Options passed to getopt
25:18 The -n option (the name of the script for error messages)
26:08 How to get the name of the script for messages
30:35 The -o and -l options (valid long and short options for the script)
31:49 The three kinds of options
33:45 How to define the three types of options in getopt
36:12 The value of opts and the three kinds of options
36:49 eval and set
38:47 The value of opts and the three kinds of options, continued
39:32 Parsing the three kinds of options in the parsing loop
39:59 Parsing options that take no arguments (flags)
43:44 The error message in case you forgot to add an option to the parsing loop, a demonstration
44:30 Parsing options that take arguments - required and optional
46:28 Options with arguments in the opts string
49:04 Options with arguments in the parsing loop
51:11 A difference in syntax between options that take required vs optional arguments
57:30 The positional arguments after parsing
58:36 A short demonstration of using options parsed with getopt in your script
1:03:48 Conclusion
1:05:20 Outro
search-in-subs on GitHub: https://github.com/linguisticmind/sea...
search-in-subs live coding series: • [Bash scripting, Live coding] search-in-su...
The script-template and getopt-demo scripts from this tutorial: https://gist.github.com/linguisticmin...
XDG Base Directory - ArchWiki: https://wiki.archlinux.org/title/XDG_...
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: