I have slept on this and I think bash is working correctly.
If you put "-a test -b -c"  all inside quotes it will be treated as a single 
flag/argument.  Leave out the quotes and it will treat it as separate 
arguments.  So below "-a test -b -c" is one argument; -b and -c are the second 
and third arguments.  Also try it without any quotes.

#!/bin/bash
while getopts 'a:bc' flag "-a test -b -c" -b -c ; 
do
  echo "$flag $OPTARG"
done

gives:

pe...@8300:~/Desktop$ ./test2.sh
a  test -b -c
b 
c 

If a bash expert can confirm this and you can change the bug status to
invalid.

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

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

Reply via email to