Parse Command Line Positional Arguments and Flags with Bash

Опубликовано: 14 Март 2023
на канале: Nick Janetakis
3,257
89

We'll cover short flags, long flags, flags with and without values and required positional args.

Hit the subscribe button to receive more videos like this!

REFERENCE LINKS
---------------------------------------------------
► https://nickjanetakis.com/blog/parse-...

COURSES
---------------------------------------------------
Courses I've created that focus on web dev and deployment topics.

► https://nickjanetakis.com/courses/

THE TOOLS I USE / GEAR
---------------------------------------------------
► https://nickjanetakis.com/blog/the-to...

FOLLOW ME ELSEWHERE
---------------------------------------------------
► Twitter:   / nickjanetakis  
► GitHub: https://github.com/nickjj

TIMESTAMPS
---------------------------------------------------
0:00 -- Intro
0:56 -- Displaying a usage message
2:44 -- Seeing how $@ works
3:19 -- Setting up variables for our inputs
4:26 -- A while loop and reducing the args until it's 0
6:23 -- Handling the help menu
7:41 -- Handling the interests (required flag)
9:11 -- Understanding how shift works
10:53 -- Handling being cool or not (optional flag)
12:05 -- Handling positional arguments
13:32 -- Exiting out if there's too many arguments
14:08 -- Validating our inputs
15:45 -- Performing your script's main purpose
16:12 -- Why I explicitly return 0 in the main function
16:52 -- For basic parsing you can skip the loop and read $1, $2, etc.


На этой странице сайта вы можете посмотреть видео онлайн Parse Command Line Positional Arguments and Flags with Bash длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Nick Janetakis 14 Март 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 3,257 раз и оно понравилось 89 зрителям. Приятного просмотра!