This is correct behaviour.  Perhaps these two examples will make it more
clear.
    $ OPTIND=1
    $ while getopts :a:bc f -a foo -b -c bar; do
    >     echo "f=$f arg='$OPTARG'"
    > done
    f=a arg='foo'
    f=b arg=''
    f=c arg=''
    $
    $ OPTIND=1
    $ while getopts :a:bc f '-a foo -b -c bar'; do
    >     echo "f=$f arg='$OPTARG'"
    > done
    f=a arg=' foo -b -c bar'
    $

** Changed in: bash (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/522591

Title:
  Bash script getopts strange behaviour

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to