Skip to content

Feature request: support for multi-value arguments #36

Description

@stephenchu

Will it be possible to support something like such in Bash getopts?

#! /bin/bash

while getopts ":t:" opt; do
  case $opt in
    t)
      TAGS+=($OPTARG)
      ;;
  esac
done
shift $((OPTIND-1))

for $tag in "${TAGS[@]}"; do
  echo "Tag: $tag"
done

Output:

$ foo.sh -t one -t two
Tag: one                                                                                            
Tag: two                                                                                            

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions