GhettoVCB - clone.sh BASH Script

From The TinkerNet Wiki
Revision as of 21:27, 1 July 2020 by Tinker (talk | contribs) (Created page with " #!/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 -m...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#!/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