Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Mar 2011 18:26:15 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        Josh Paetzel <jpaetzel@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r220162 - head/usr.sbin/pc-sysinstall/backend-partmanager
Message-ID:  <BANLkTimHkjLF-paCJ6Oxro5%2BvoZQe12t%2BQ@mail.gmail.com>
In-Reply-To: <201103301737.p2UHb4j7070331@svn.freebsd.org>
References:  <201103301737.p2UHb4j7070331@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 30, 2011 at 10:37 AM, Josh Paetzel <jpaetzel@freebsd.org> wrote=
:
> Author: jpaetzel
> Date: Wed Mar 30 17:37:04 2011
> New Revision: 220162
> URL: http://svn.freebsd.org/changeset/base/220162
>
> Log:
> =A0Check in two missing files missed in cleanup.
> =A0Change expr to $(())
> =A0Switch test from "$?" =3D "0" to $? -eq 0
>
> =A0Approved by: =A0kib (mentor)
>
> Modified:
> =A0head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
> =A0head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh
>
> Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh =A0 =
=A0 =A0Wed Mar 30 17:33:52 2011 =A0 =A0 =A0 =A0(r220161)
> +++ head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh =A0 =
=A0 =A0Wed Mar 30 17:37:04 2011 =A0 =A0 =A0 =A0(r220162)
> @@ -85,7 +85,7 @@ fi
>
> =A0# If this is an empty disk, see if we need to create a new scheme for =
it
> =A0gpart show ${DISK} >/dev/null 2>/dev/null
> -if [ "$?" !=3D "0" -a "${SLICENUM}" =3D "1" ] ; then
> +if [ $? -eq 0 -a "${SLICENUM}" =3D "1" ] ; then
> =A0gpart create -s ${TYPE} ${DISK}
> =A0fi
>
>
> Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh =A0 =
=A0 =A0Wed Mar 30 17:33:52 2011 =A0 =A0 =A0 =A0(r220161)
> +++ head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh =A0 =
=A0 =A0Wed Mar 30 17:37:04 2011 =A0 =A0 =A0 =A0(r220162)
> @@ -57,10 +57,10 @@ PARTINDEX=3D""
> =A0while
> =A0z=3D1
> =A0do
> - =A0CHARS=3D`expr $CHARS - 1`
> + =A0CHARS=3D$((CHARS-1))

This can also be done with the null operator:

: $(( CHARS -=3D 1 ))

it's the way that the LTP project (which I'm still a member of) does
things in order to be 'portable' (non-portable being bash/korn shell
isms for what little it's worth :)..).

> =A0 LAST_CHAR=3D`echo "${PARTITION}" | cut -c $CHARS`
> - =A0echo "${LAST_CHAR}" | grep "^[0-9]$" >/dev/null 2>/dev/null
> - =A0if [ "$?" =3D "0" ] ; then
> + =A0echo "${LAST_CHAR}" | grep -q "^[0-9]$" 2>/dev/null
> + =A0if [ $? -eq 0 ] ; then
> =A0 =A0 PARTINDEX=3D"${LAST_CHAR}${PARTINDEX}"
> =A0 else
> =A0 =A0 break

Thanks!
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTimHkjLF-paCJ6Oxro5%2BvoZQe12t%2BQ>