Skip to content

Instantly share code, notes, and snippets.

@steadystatic
Last active November 2, 2015 22:20
Show Gist options
  • Save steadystatic/d01d229a1e79b37c566f to your computer and use it in GitHub Desktop.
Save steadystatic/d01d229a1e79b37c566f to your computer and use it in GitHub Desktop.
Destroy multiple DigitalOcean images with bash array and tugboat
#!/bin/bash
#Array of image ids, find these by checking `tugboat images`
images=("14191201" "14191223" "14191250" "14191302" "14191377" "14191400" "14191425" "14191441" "14191462" "14191483" "14191505" "14191517" "14191537" "14191615" "14191636" "14191655" "14191674" "14191698" "14191729" "14191747" "14191793" "14191768" "14191812")
#Array length
imageLength=${#images[@]}
for (( i=0; i<${imageLength}; i++));
do
#Auto destroy all image IDs in the above array in a for loop
yes | tugboat destroy_image -i ${images[$i]}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment