[PATCH build] Make '['/'test' consistent.

Jeremy Huddleston jeremyhu at apple.com
Mon Sep 13 22:51:55 PDT 2010


I personally prefer [ ] over test ... 


On Sep 13, 2010, at 21:22, Trevor Woerner wrote:

> From: Trevor Woerner <twoerner at gmail.com>
> 
> Modify all instances of '[' to use 'test'
> so all expressions use 'test'.
> 
> Signed-off-by: Trevor Woerner <twoerner at gmail.com>
> ---
> build.sh |   26 +++++++++++++-------------
> 1 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/build.sh b/build.sh
> index 25965fd..ce0ab8c 100755
> --- a/build.sh
> +++ b/build.sh
> @@ -94,7 +94,7 @@ checkfortars() {
>             esac
>             ;;
>         "font")
> -            if [ "$C" != "encodings" ]; then
> +            if test "$C" != "encodings" ; then
>                 C="font-$C"
>             fi
>             ;;
> @@ -133,11 +133,11 @@ checkfortars() {
>     for ii in $M .; do
>         for jj in bz2 gz; do
>             TARFILE=`ls -1rt $ii/$C-*.tar.$jj 2> /dev/null | tail -n 1`
> -            if [ -n "$TARFILE" ]; then
> +            if test -n "$TARFILE" ; then
>                 SRCDIR=`echo $TARFILE | sed "s,.tar.$jj,,"`
> -                if [ ! -d $SRCDIR ]; then
> +                if test ! -d $SRCDIR ; then
>                     TAROPTS=xjf
> -                    if [ "$jj" = "gz" ]; then
> +                    if test "$jj" = "gz" ; then
>                         TAROPTS=xzf
>                     fi
>                     tar $TAROPTS $TARFILE -C $ii || failed tar $1 $2
> @@ -187,13 +187,13 @@ clone() {
> }
> 
> build() {
> -    if [ -n "$LISTONLY" ]; then
> +    if test -n "$LISTONLY" ; then
> 	echo "$1/$2"
> 	return 0
>     fi
> 
> -    if [ -n "$RESUME" ]; then
> -	if [ "$RESUME" = "$1/$2" ]; then
> +    if test -n "$RESUME" ; then
> +	if test "$RESUME" = "$1/$2" ; then
> 	    unset RESUME
> 	    # Resume build at this module
> 	else
> @@ -204,12 +204,12 @@ build() {
> 
>     SRCDIR=""
>     CONFCMD=""
> -    if [ -f $1/$2/autogen.sh ]; then
> +    if test -f $1/$2/autogen.sh ; then
>         SRCDIR="$1/$2"
>         CONFCMD="autogen.sh"
> -    elif [ "x$CLONE" != "x" ]; then
> +    elif test "x$CLONE" != "x" ; then
>         clone $1 $2
> -        if [ $? -ne 0 ]; then
> +        if test $? -ne 0 ; then
>             echo "Failed to clone $1 module component $2. Ignoring."
>             clonefailed_components="$clonefailed_components $1/$2"
>             if test x"$BUILD_ONE" = x1; then
> @@ -224,7 +224,7 @@ build() {
>         CONFCMD="configure"
>     fi
> 
> -    if [ -z $SRCDIR ]; then
> +    if test -z $SRCDIR ; then
>         echo "$1 module component $2 does not exist, skipping."
>         nonexistent_components="$nonexistent_components $1/$2"
>         return
> @@ -244,7 +244,7 @@ build() {
>     fi
> 
>     # Build outside source directory
> -    if [ "x$DIR_ARCH" != x ] ; then
> +    if test "x$DIR_ARCH" != x  ; then
> 	mkdir -p "$DIR_ARCH" || failed mkdir $1 $2
> 	if cd "$DIR_ARCH" ; then :; else
> 	    failed cd2 $1 $2
> @@ -821,7 +821,7 @@ do
>     --autoresume)
> 	shift
> 	BUILT_MODULES_FILE=$1
> -	[ -f $1 ] && RESUME=`tail -n 1 $1`
> +	test -f $1  && RESUME=`tail -n 1 $1`
> 	;;
>     -s)
> 	shift
> -- 
> 1.7.3.rc1.4.g5879b6
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



More information about the xorg-devel mailing list