Bugzilla – Bug 55
fnmatch does not seem to work
Last modified: 2001-10-30 20:55:11 MST
glibc-2.2-12 $ sudo -V Sudo version 1.6.3p6 $ sudo -l User hippy may run the following commands on this host: (root) NOPASSWD: /usr/bin/args a* $ cat /usr/bin/args #! /bin/bash echo "PID is $$" id echo "Argument count is $#" echo "argv[0] = $0" count=1 while [ $# -gt 0 ] do echo "argv[$count] = $1" shift count=$(($count + 1)) done $ sudo /usr/bin/args a b c d 5 PID is 25313 uid=0(root) gid=0(root) groups=501(admin),10(wheel),500(www) Argument count is 5 argv[0] = /usr/bin/args argv[1] = a argv[2] = b argv[3] = c argv[4] = d argv[5] = 5
The problem is that '*' matches anything, including multiple arguments. It is much like '*' in the shell.
But shouldn't a* only match arguments starting with an 'a' like in the shell? $ mkdir crap $ touch crap/{a,b,c} $ ls crap/a* crap/a Matching multiple arguments not starting with 'a' is not intuitive.