19 lines
413 B
Text
19 lines
413 B
Text
|
#!/bin/sh
|
||
|
#
|
||
|
# This script extract VM IDs and filter them if a pattern is provided as first
|
||
|
# argument.
|
||
|
|
||
|
set -e
|
||
|
|
||
|
# Extract instances from ONE.
|
||
|
instances=$(onevm list --csv | tail -n +2)
|
||
|
|
||
|
# Filter them is a pattern has been provided.
|
||
|
if [ "$1" != "" ]; then
|
||
|
filtered_instances="$(echo "$instances" | grep -E "$1")"
|
||
|
instances="$filtered_instances"
|
||
|
fi
|
||
|
|
||
|
# Outputs instance IDs.
|
||
|
echo "$instances" | cut -d ',' -f 1 -
|