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

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

License

Notifications You must be signed in to change notification settings

ko1nksm-shlab/optionsh

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages