Replaced function with default variable value

This commit is contained in:
Alex Tavarez
2025-09-17 12:34:56 -04:00
parent 92cfaebb66
commit 9585df0209

View File

@@ -1,9 +1,7 @@
#!/bin/bash
set -euo pipefail
clear-apt-snaps () {
zfs list -t snapshot | grep 'apt-' | sed 's| .*$||g' | head -n -5 | xargs -d '\n' -I {} sudo zfs destroy {}
}
REGEX='apt-'
if [ -z "$1" ]; then
exit 1
@@ -19,9 +17,5 @@ if [ -n "$1" ] && [ "$1" == "upgrades" ]; then
esac
done
if [ -z "$REGEX" ]; then
clear-apt-snaps
else
zfs list -t snapshot | grep "${REGEX}" | sed 's| .*$||g' | head -n -5 | xargs -d '\n' -I {} sudo zfs destroy {}
fi
fi