#!/bin/sh if [ "$1" = "-h" ]; then cat <&2 Usage: ${0##*/} Automatically unmount external drives mounted with 'udisks'. EOF exit fi while IFS= read -r i; do udisksctl unmount -b "$(findmnt -n --output SOURCE "$i")" done <