[pacman-dev] [PATCH] makepkg: use double brackets

Andres P aepd87 at gmail.com
Wed May 26 12:05:40 EDT 2010


Change all instances of the (test) [ builtin to the [[ keyword.

Signed-off-by: Andres P <aepd87 at gmail.com>
---

v2
remove comment regarding bash 4.0 hack

 scripts/makepkg.sh.in |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 8c0da8b..773d779 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1296,7 +1296,7 @@ check_sanity() {
 
 	if (( ${#pkgname[@]} > 1 )); then
 		for pkg in ${pkgname[@]}; do
-			if [ "$(type -t package_${pkg})" != "function" ]; then
+			if [[ $(type -t package_${pkg}) != "function" ]]; then
 				error "$(gettext "missing package function for split package '%s'")" "$pkg"
 				return 1
 			fi
@@ -1805,14 +1805,12 @@ if (( ${#pkgname[@]} > 1 )); then
 fi
 
 # test for available PKGBUILD functions
-# The exclamation mark is required here to avoid triggering the ERR trap when
-# a tested function does not exist.
-if [[ $(! type -t build) = "function" ]]; then
+if [[ $(type -t build) = "function" ]]; then
 	BUILDFUNC=1
 fi
-if [ "$(type -t package)" = "function" ]; then
+if [[ $(type -t package) = "function" ]]; then
 	PKGFUNC=1
-elif [ $SPLITPKG -eq 0 -a "$(type -t package_${pkgname})" = "function" ]; then
+elif [[ $SPLITPKG -eq 0 && $(type -t package_${pkgname}) = "function" ]]; then
 	SPLITPKG=1
 fi
 
-- 
1.7.1



More information about the pacman-dev mailing list