Merge "vm_shell: validate selected CID"
diff --git a/vm/vm_shell.sh b/vm/vm_shell.sh
index ec9243b..8217901 100755
--- a/vm/vm_shell.sh
+++ b/vm/vm_shell.sh
@@ -40,12 +40,7 @@
exit 1
fi
-if [ -n "${selected_cid}" ]; then
- if [[ ! " ${available_cids[*]} " =~ " ${selected_cid} " ]]; then
- echo VM of CID $selected_cid does not exist. Available CIDs: ${available_cids}
- exit 1
- fi
-else
+if [ ! -n "${selected_cid}" ]; then
PS3="Select CID of VM to adb-shell into: "
select cid in ${available_cids}
do
@@ -54,4 +49,9 @@
done
fi
+if [[ ! " ${available_cids[*]} " =~ " ${selected_cid} " ]]; then
+ echo VM of CID $selected_cid does not exist. Available CIDs: ${available_cids}
+ exit 1
+fi
+
connect_vm ${selected_cid}