Index: select.sh
===================================================================
--- select.sh	(revision 34398)
+++ select.sh	(working copy)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -e
 #
 # $Id: portdestroot.tcl 27199 2007-07-24 09:09:43Z mww@macports.org $
 #
@@ -53,17 +53,19 @@
 
 # print the usage of this tool
 usage() {
-	echo "usage: ${TOOL} [-n] [-f] [-r] [-h] [-v] version"
-	echo ""
-	echo "-n        Show commands to do selection but do not execute them."
-	echo "-f        Ensure the links are correct for the specified version"
-	echo "          even if it maches the current default version."
-	echo "-h        Display this help info."
-	echo "-r        Skip test for necessary rights."
-	echo "-v        Display version of ${0}."
-	echo "-l        List available options for version."
-	echo "-i path   Install mode to perform an initial selection in path."
-	echo ""
+	cat <<EOD
+usage: ${TOOL} [-n] [-f] [-r] [-h] [-v] version
+
+-n        Show commands to do selection but do not execute them.
+-f        Ensure the links are correct for the specified version
+          even if it maches the current default version.
+-h        Display this help info.
+-r        Skip test for necessary rights.
+-v        Display version of ${TOOL}.
+-l        List available options for version.
+-i path   Install mode to perform an initial selection in path.
+
+EOD
 }
 
 # print the version of this tool
@@ -80,7 +82,7 @@
 # test if a particular version is available
 version_is_valid() {
 	for version in $(ls -1 ${CONFPATH} | grep -v base); do
-		if [ ${1} == ${version} ]; then
+		if [ "${1}" == "${version}" ]; then
 			return 0
 		fi
 	done
@@ -89,14 +91,14 @@
 
 # perform an action (command) or just display it
 action() {
-	if [ "rm" == ${1} ]; then
-		if [ 1 == ${noexec} ]; then
+	if [ "rm" == "${1}" ]; then
+		if [ 1 == "${noexec}" ]; then
 			echo "rm -f ${2}"
 		else
 			rm -f ${2}
 		fi
-	elif [ "ln" == ${1} ]; then
-		if [ 1 == ${noexec} ]; then
+	elif [ "ln" == "${1}" ]; then
+		if [ 1 == "${noexec}" ]; then
 			echo "ln -sf ${2} ${3}"
 		else
 			ln -sf ${2} ${3}

