ctdb-tools: Detect unknown node number
[vlendec/samba-autobuild/.git] / ctdb / tools / onnode
index eabe034d227a7a177bb04070f916dd92da58c3b3..13b0d19b3eececb2ddcbedb7fcd5c9a73d72ad4d 100755 (executable)
@@ -102,8 +102,12 @@ echo_nth ()
 {
     local n="$1" ; shift
 
-    shift "$n"
-    local node="$1"
+    # Note that this is 0-based
+    local node=""
+    if [ "$n" -le $# ] ; then
+           shift "$n"
+           node="$1"
+    fi
 
     if [ -n "$node" -a "$node" != "#DEAD" ] ; then
        echo "$node"