[pacman-dev] [PATCH 2/2] remove OPT_TEMP hack in parse_options call
DJ Mills
danielmills1 at gmail.com
Fri Jul 8 00:31:23 EDT 2011
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 at gmail.com>
---
scripts/makepkg.sh.in | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
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,nocheck,nosign,pkg:,rmdeps"
OPT_LONG+=",repackage,skipinteg,sign,source,syncdeps,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
More information about the pacman-dev
mailing list