1 |
On Thu, 31 May 2012 02:09:11 -0400 |
2 |
Mike Frysinger <vapier@g.o> wrote: |
3 |
|
4 |
> yet, if you read the actual code, you'll see: |
5 |
> + [[ ${#} -le 1 ]] || die "Invalid number of args to |
6 |
> ${FUNCNAME}()" |
7 |
> + if [[ ${#} -eq 1 ]]; then |
8 |
> + ... |
9 |
> + fi |
10 |
> |
11 |
> that means if more than 1 argument is passed, no error is thrown. |
12 |
|
13 |
The exact opposite. If more than a single argument is passed, error is |
14 |
thrown. |
15 |
|
16 |
> thought you were intending to parse $@ further on because of it |
17 |
> (hence the suggestion of updating the @USAGE), but it looks merely |
18 |
> like your arg parsing is incorrect and needs fixing. probably |
19 |
> easiest by doing: case $#:$1 in |
20 |
> 0:'') ;; |
21 |
> 1:all) removing_all=1 ;; |
22 |
> *) die "invalid usage" ;; |
23 |
> esac |
24 |
|
25 |
Just a little reverse logic in spirit of makefiles. But the case |
26 |
variant would be probably more readable indeed. |
27 |
|
28 |
-- |
29 |
Best regards, |
30 |
Michał Górny |