Renamed script, and made what is being deleted conditional and based on user input for piped 'grep' command
This commit is contained in:
		@@ -1,4 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -euo pipefail
 | 
			
		||||
 | 
			
		||||
zfs list -t snapshot | grep 'apt-' | sed 's| .*$||g' | head -n -5 | xargs -d '\n' -I {} sudo zfs destroy {}
 | 
			
		||||
							
								
								
									
										14
									
								
								zfs/zfs-selective-destroy.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								zfs/zfs-selective-destroy.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -euo pipefail
 | 
			
		||||
 | 
			
		||||
zfs-clean () {
 | 
			
		||||
    if [ -z "$1" ]; then
 | 
			
		||||
        exit 1
 | 
			
		||||
    elif [ "$1" == "upgrades" ]; then
 | 
			
		||||
        if [ -z "$2" ]; then
 | 
			
		||||
            zfs list -t snapshot | grep 'apt-' | sed 's| .*$||g' | head -n -5 | xargs -d '\n' -I {} sudo zfs destroy {}
 | 
			
		||||
        else
 | 
			
		||||
            zfs list -t snapshot | grep "${2}" | sed 's| .*$||g' | head -n -5 | xargs -d '\n' -I {} sudo zfs destroy {}
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user