This patch is against CVS 2013-04-20 buildrpm.sh
- Use /bin/sh. The file is POSIX compliant now.
- Instead of ${var}, simplify variabled to $var.
- Send errors to STDERR, normal messages to STDOUT.
- Prefer POSIX $() to archaic backquotes `` [1]
- Prefer simple [ "$var" ] and [ ! "$var" ] test. The -n and -z
tests are not needed.
- Use standard built-in echo(1) instead of external printf(1).
- Prefer built-in "[]" instead of possibly external call test(1).
- Prefer "[ test ] COND [ test ]" instead of "[ test COND test ]"
which does not short circuit and may be portability problem [2]
[1]
POSIX standard provides the $(...) command substitution syntax, which
improves legibility and allows nested structures.
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_03
Also a good read: http://mywiki.wooledge.org/BashFAQ/082
[2] http://mywiki.wooledge.org/BashPitfalls#A.5B_.22.24foo.22_.3D_bar_.26.26_.22.24bar.22_.3D_foo_.5D
buildrpm.sh POSIX