GhettoVCB - clone.sh BASH Script
Jump to navigation
Jump to search
Do note that this is just the code to create the menu, no actual handling here. (Because sh, as implemented in ESXi is kinda limited...)
#!/bin/bash
echo "Select the Baseline you would like to make your clone from."
unset options i
while IFS= read -r -d $'\0' f; do
options[i++]="$f"
done < <(find -maxdepth 1 -type d -name "CloneMe-*" -printf '%f\0' )
PS3="Enter a number (anything not in the list cancels): "
select opt in ${options[@]} #Cancel
do
case $opt in
CloneMe-*)
echo "Baseline $opt selected"
# processing
ls $opt
;;
*)
echo "This is not in the list"
echo "Cancelled!"
break
;;
esac
done