[arch-dev-public] [PATCH 3/3] sourceballs: Added community and community-testing support

Dan McGee dpmcgee at gmail.com
Sun Mar 14 23:55:47 CET 2010


On Sat, Mar 13, 2010 at 2:58 PM, Eric Bélanger <snowmaniscool at gmail.com> wrote:
> On Sat, Mar 13, 2010 at 5:46 AM, Pierre Schmitz <pierre at archlinux.de> wrote:
>> Am Montag, 8. Februar 2010 16:13:44 schrieb Eric Bélanger:
>>> -    if ! /usr/bin/svn export -q --force "$SVNREPO/$packagename"
>>> "$packagename" >/dev/null 2>&1 ; then +    if ! $(/usr/bin/svn export -q
>>> --force "$SVNREPO/$packagename" "$packagename" >/dev/null 2>&1) \
>>> +       && ! $(/usr/bin/svn export -q --force
>>> "$SVNREPOCOMMUNITY/$packagename" "$packagename" >/dev/null 2>&1) ; then
>>
>> I think replacing "if command" with "if $(command)" is probably not what you
>> want as you are no longer checking the return value but the output. Or I am
>> just wrong here?
>>
>
> I'm not a bash expert but it seem to be doing the same thing:
>
> $ if ! ls >/dev/null 2>&1 ;then echo fail; fi
> $ if ! $(ls >/dev/null 2>&1) ;then echo fail; fi
> $ if ! foo >/dev/null 2>&1 ;then echo fail; fi
> fail
> $ if ! $(foo >/dev/null 2>&1) ;then echo fail; fi
> fail

This is a very bad example. Try not suppressing all output which is
very misleading (why do we do this so damn often in scripts anyway?).

dmcgee at galway /tmp/test
$ if ! ls; then echo "fail"; fi
onefile

dmcgee at galway /tmp/test
$ if ! $(ls); then echo "fail"; fi
bash: onefile: command not found
fail

dmcgee at galway /tmp/test
$ if ! foo; then echo "fail"; fi
bash: foo: command not found
fail

dmcgee at galway /tmp/test
$ if ! $(foo); then echo "fail"; fi
bash: foo: command not found
fail


-Dan


More information about the arch-dev-public mailing list