```bash

```
#!/bin/bash
set -eu

snapsToRemove=$(snap list --all | awk '/disabled/{print $1, $2, $3}')

while read snapname version revision; do
    if [[ "$revision" == *[a-zA-z]* ]]; then
        # Version field is empty. Revision is in second field
        revision=$version
    fi
        snap remove "$snapname" --revision="$revision"
done <<< $snapsToRemove

sudo snap set system refresh.retain=2
```