svn commit: r220162 - head/usr.sbin/pc-sysinstall/backend-partmanager

Garrett Cooper yanegomi at gmail.com
Thu Mar 31 01:26:18 UTC 2011


On Wed, Mar 30, 2011 at 10:37 AM, Josh Paetzel <jpaetzel at 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:
>  Check in two missing files missed in cleanup.
>  Change expr to $(())
>  Switch test from "$?" = "0" to $? -eq 0
>
>  Approved by:  kib (mentor)
>
> Modified:
>  head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
>  head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh
>
> Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
> ==============================================================================
> --- head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh      Wed Mar 30 17:33:52 2011        (r220161)
> +++ head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh      Wed Mar 30 17:37:04 2011        (r220162)
> @@ -85,7 +85,7 @@ fi
>
>  # If this is an empty disk, see if we need to create a new scheme for it
>  gpart show ${DISK} >/dev/null 2>/dev/null
> -if [ "$?" != "0" -a "${SLICENUM}" = "1" ] ; then
> +if [ $? -eq 0 -a "${SLICENUM}" = "1" ] ; then
>  gpart create -s ${TYPE} ${DISK}
>  fi
>
>
> Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh
> ==============================================================================
> --- head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh      Wed Mar 30 17:33:52 2011        (r220161)
> +++ head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh      Wed Mar 30 17:37:04 2011        (r220162)
> @@ -57,10 +57,10 @@ PARTINDEX=""
>  while
>  z=1
>  do
> -  CHARS=`expr $CHARS - 1`
> +  CHARS=$((CHARS-1))

This can also be done with the null operator:

: $(( CHARS -= 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 :)..).

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

Thanks!
-Garrett


More information about the svn-src-all mailing list