Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Allows you to combine getopt with getopts and also get rid of the need for --longopt=x

License

Notifications You must be signed in to change notification settings

BiteDasher/sortopts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sortopts

Allows you to combine getopt with getopts and also get rid of the need for --longopt=x

Variabels

OPTOUT=1 - Only display all received arguments, do not parse

SHORTDASH=1 - Print one dash before short parsed arguments

PARSER=1 - Separate the key and its value from each other with a straight line (|)

Example:

./sortopts "a:b:c:d:-" "one:,two,three::" \
           -a1 -b 2 -c3 -d 4 \
	   --one --two --three 3

Needed binaries:

bash
getopt (from util-linux)

if you want to use only bash built-in tools, no third party binaries

Use legacyopts. There, for parsing short arguments, getopts is used - a utility built into the bash.

Keep in mind that handling x:: and x:- arguments will NOT work in this version of the script.

About

Allows you to combine getopt with getopts and also get rid of the need for --longopt=x

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages