From 5df4738c72485e6788e70ce021ce266aa556acfa Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 22 Nov 2013 16:18:55 +0100 Subject: wibble Replaced [ -n "$string" ] with [ "$string" ], and [ -z "$string" ] with [ ! "$string" ]. --- virtualenv/virt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'virtualenv') diff --git a/virtualenv/virt b/virtualenv/virt index b88d04e..043589f 100755 --- a/virtualenv/virt +++ b/virtualenv/virt @@ -10,7 +10,7 @@ set -ue root=$(dirname "$0") -help() { +usage() { cat >&2 <<-EOF Usage: $0 install [] @@ -41,7 +41,7 @@ isActive() { } install() { - [ $# -eq 1 -o $# -eq 2 ] || help + [ $# -eq 1 -o $# -eq 2 ] || usage local name=$1 local disk=${2:-$root/images/${name}.qcow2} @@ -103,7 +103,7 @@ install() { | sed '/^\s*$/d' \ | sort -n \ | tail -1 ) - [ -n "$ip" ] || \ + [ "$ip" ] || \ ip=$( /usr/bin/virsh net-dumpxml $network \ | /usr/bin/xmlstarlet sel -t -m /network/ip -v @address ) ip=${ip%.*}.$(( 1 + ${ip##*.} )) @@ -123,7 +123,7 @@ install() { } view(){ - [ $# -eq 1 ] || help + [ $# -eq 1 ] || usage local domain="$1" if ! doesExist "$domain"; then @@ -141,17 +141,18 @@ view(){ local type=$(get_XML_attribute "$domain" devices/graphics type) local port=$(get_XML_attribute "$domain" devices/graphics port) || true - if [ "$type" != spice -o -z "$port" ]; then + if ! [ "$type" = spice -a "$port" ]; then echo "Error: Could not find a valid Spice server on domain '$domain'." >&2 exit 1 fi /usr/bin/spicec -h 127.0.0.1 -p $port } -command="${1:-}" +[ $# -gt 0 ] || usage +command="$1" shift; case "$command" in install|view) $command "$@";; - *) help + *) usage esac -- cgit v1.2.3