vagrant Snapshots Bash script to delete all snapshots


Example

#!/bin/bash

NO_SNAPSHOTS="No snapshots have been taken yet"
SNAPSHOT_OUTPUT=$(vagrant snapshot list | grep "${NO_SNAPSHOTS}")

if [ -z "${SNAPSHOT_OUTPUT}" ]; then
    echo "Found some snapshots, going to remove them"
    for SNAPSHOT in $(vagrant snapshot list); do
        vagrant snapshot delete "${SNAPSHOT}"
    done
else
    echo "No snapshots found"
fi