Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Latest commit

 

History

History
30 lines (19 loc) · 996 Bytes

README.md

File metadata and controls

30 lines (19 loc) · 996 Bytes

option.sh

Option parse code for POSIX-compliant shell scripts that high function and short.

⚠️ No maintenance anymore. Use the getoptions - An elegant option parser for shell scripts (sh, bash, zsh and all POSIX shells).

Sample

Implements step by step.

  • option1.sh: Supports flag option and parameters only
  • option2.sh: Supports option argument
  • option3.sh: Supports a mixture of options and operands
  • option4.sh: Stop option parsing with --
  • option5.sh: Supports combined short options
  • option6.sh: Supports combined option and argument
  • option7.sh: Supports optional option argument
  • option8.sh: Inverse flag option with +, --no-

Note: This sample reuses the OPTIND and OPTARG variables for other purposes.

Explanation is in Japanese only, sorry.

Test

Tested by shellspec.

License

Unlicense. Feel free to use it.