1 |
On Sun, 15 May 2016 21:35:41 +0200 |
2 |
rindeal <dev.rindeal@×××××.com> wrote: |
3 |
|
4 |
> > Dnia 15 maja 2016 15:31:29 CEST, Jan Chren <dev.rindeal@×××××.com> napisał(a): |
5 |
> >>+ local f="${!i}" |
6 |
> >>+ if [ "${f#-${findflag#-}}" != "${f}" ] ; then |
7 |
> > |
8 |
> > I know the original code sucked as well but could you replace this with more readable [[ ${f} == -${findflag#-}* ]] or alike (note: not tested). |
9 |
> |
10 |
> This is just as buggy as my original implementation, I've reworked it |
11 |
> and thanks to the tests I hope it's now correct. |
12 |
|
13 |
It is still unreadable. The point is, we use bash here, so please use |
14 |
bash features (i.e. == with wildcards) to do comparison rather than |
15 |
limited shell-style stripping of variables. |
16 |
|
17 |
> >>+ printf "%s\n" "${f#-${findflag}=}" |
18 |
> > |
19 |
> > It may be a good idea to add a short explanation why you can't use echo here, as a comment. |
20 |
> |
21 |
> I've just copied what was there before, `echo` in bash is notoriously |
22 |
> wild, but with this simple string I guess it's ok, so done. |
23 |
|
24 |
I meant you should add a comment that you can't use echo because flags |
25 |
like '-n' or '-e' would confuse it :-P. |
26 |
|
27 |
-- |
28 |
Best regards, |
29 |
Michał Górny |
30 |
<http://dev.gentoo.org/~mgorny/> |