Files
dotfiles/config/scripts/.local/scripts/smb-umount
2026-02-12 22:22:42 +01:00

28 lines
473 B
Bash
Executable File

#!/usr/bin/env bash
# Description:
# Unmount all cifs mounts
#
# Requirements:
# - cifs-utils
# - sudo privileges
[ "$(id -u)" -eq 0 ] && {
echo "Do not run this script in sudo mode."
exit 1
}
mount_points=$(mount | grep ' type cifs ' | awk '{print $3}')
[ -z "$mount_points" ] && {
echo "No cifs mounts found."
exit 0
}
for mp in $mount_points; do
echo "Unmounting $mp"
sudo umount "$mp" || {
echo "Failed to unmount $mp"
}
done