Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattbryson/bash-arg-parse
Simple CLI argument parsing template for a stand alone bash script
https://github.com/mattbryson/bash-arg-parse
Last synced: 5 days ago
JSON representation
Simple CLI argument parsing template for a stand alone bash script
- Host: GitHub
- URL: https://github.com/mattbryson/bash-arg-parse
- Owner: mattbryson
- License: mit
- Created: 2017-11-09T20:09:50.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-03T20:05:43.000Z (almost 6 years ago)
- Last Synced: 2024-11-04T22:37:14.341Z (9 days ago)
- Language: Shell
- Size: 1.95 KB
- Stars: 63
- Watchers: 5
- Forks: 18
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Bash Arg Parse Example
A simple bash script that can parse named, short and positional CLI arguments.This is to be used as a template for simple bash scripts that accept various CLI arguments.
# Usage
Use `arg_parse_example` as the basis of a bash cli script.To run the example...
````bash
$ ./arg_parse_example -h
usage: arg_parse_example -a AN_ARG -s SOME_MORE_ARGS [-y YET_MORE_ARGS || -h]-a | --an_arg : A super special argument
-s | --some_more_args : Another argument
-y | --yet_more_args : An optional argument
-h | --help : This message
````````bash
$ ./arg_parse_example -a foo --some_more_args bar one two
you passed in...positional arg 1: one
positional arg 2: two
named arg: an_arg: foo
named arg: some_more_args: bar
named arg: yet_more_args: a default value
````