On Sat, Mar 13, 2010 at 2:58 PM, Eric Bélanger <snowmaniscool@gmail.com> wrote:
On Sat, Mar 13, 2010 at 5:46 AM, Pierre Schmitz <pierre@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@galway /tmp/test $ if ! ls; then echo "fail"; fi onefile dmcgee@galway /tmp/test $ if ! $(ls); then echo "fail"; fi bash: onefile: command not found fail dmcgee@galway /tmp/test $ if ! foo; then echo "fail"; fi bash: foo: command not found fail dmcgee@galway /tmp/test $ if ! $(foo); then echo "fail"; fi bash: foo: command not found fail -Dan