Instead of using var=$(command || echo blah); if [[ $var = *"blah"* ]],
which IMO is a creative hack, but very unnecessary, simply use:
if ! var=$(command); then
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index e215c4b..3152bf1 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1752,9 +1752,7 @@ OPT_LONG+=",install,key:,log,nocolor,nobuild,noche ck,nosign,pkg:,rmdeps"
OPT_LONG+=",repackage,skipinteg,sign,source,syncde ps,version,config:"
# Pacman Options
OPT_LONG+=",noconfirm,noprogressbar"
-OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@" || echo 'PARSE_OPTIONS FAILED')"
-if [[ $OPT_TEMP = *'PARSE_OPTIONS FAILED'* ]]; then
- # This is a small hack to stop the script bailing with 'set -e'
+if ! OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@")"; then
echo; usage; exit 1 # E_INVALID_OPTION;
fi
eval set -- "$OPT_TEMP"
--
1.7.6
07-08-2011, 07:05 AM
Allan McRae
remove OPT_TEMP hack in parse_options call
On 08/07/11 14:31, DJ Mills wrote:
Instead of using var=$(command || echo blah); if [[ $var = *"blah"* ]],
which IMO is a creative hack, but very unnecessary, simply use:
if ! var=$(command); then
This patch gets rid of the hack.
Signed-off-by: DJ Mills<danielmills1@gmail.com>
On my working branch with a changed commit message.