On 22/05/2008, at 1:13 AM, Xavier wrote: > It is not eval, it is set. As far as I can tell, it is perfectly > normal, > that call seems to be made exactly for that purpose: changing the args > ($@, $1, etc). And I get the same behavior here anyway.
I see. After some playing around it seems that this version of getopt simply doesn't support any parameters. Using "getopt abc $@" works fine. When running the test script with "-a -b -c", $@ becomes "-a -b - c --". If "getopt -o abs $@" is used, $@ becomes "-- abc -a -b -c", in which case makepkg would immediately break out of the loop. > $ cat test.sh > #!/bin/bash > echo "[EMAIL PROTECTED]@" > args=$(getopt abc $@) > if [ $? != 0 ]; then > echo "Invalid arguments" > exit 1 > fi > eval set -- $args > echo "[EMAIL PROTECTED]@" > while true; do > case "$1" in > -a|-b|-c) > echo "Got $1"; shift;; > *) > echo "Invalid: $1"; break;; > esac > done > > $ ./test.sh -a -b -c > [EMAIL PROTECTED] -b -c > [EMAIL PROTECTED] -b -c -- > Got -a > Got -b > Got -c > Invalid: -- After changing "getopt abc $@" to "getopt -o abc $@": > $ ./test.sh -a -b -c > [EMAIL PROTECTED] -b -c > [EMAIL PROTECTED] abc -a -b -c Invalid: -- --- Sebastian Nowicki _______________________________________________ pacman-dev mailing list [email protected] http://archlinux.org/mailman/listinfo/pacman-dev
