On 09/13/2011 07:24, Amadeusz Żołnowski wrote:
> Hi,
>
>
> Excerpts from Michal Hrusecky's message of 2011-09-13 13:11:28 +0200:
>> Comments and improvements are welcome.
>
> Just some minor remarks:
>
>
>> [[ -z ${OPENSUSE_RELEASE} ]] || OBS_PROJECT="openSUSE:${OPENSUSE_RELEASE}"
>> [[ -n ${OBS_PROJECT} ]] || die "OBS_PROJECT not set!"
>> [[ -n ${OBS_PACKAGE} ]] || die "OBS_PACKAGE not set!"
>
> You don't need -n/-z with [[.
>
> [[ $var ]] == [[ -n $var ]]
> [[ ! $var ]] == [[ -z $var ]]
>
What about other comparisons, like -f, -e, or -d? Bash's manpage only says
[[ expression ]] -- it doesn't seem to go into the level of detail (at least
not in the section that I quickly perused) about what flag operators are
necessary or not.
Also, is this a bash4-only thing, or bash3 and/or bash2 as well?
If yes to above, we should get this edited and fixed up, then, because it
uses -z/-n inside [[ ]]:
http://devmanual.gentoo.org/tools-reference/bash/index.html
Oh, forgot, it won't break initscripts, will it?
--
Joshua Kinard
Gentoo/MIPS
kumba@g.o
4096R/D25D95E3 2011-03-28
"The past tempts us, the present confuses us, the future frightens us. And
our lives slip away, moment by moment, lost in that vast, terrible in-between."
--Emperor Turhan, Centauri Republic
|