from my .bashrc: mounted() { mount | grep -q "on $1 type" } safe_umount() { while mounted "$1"; do echo sudo umount "$1" sudo umount "$1" || sleep 5 done } penmount() { local target="$HOME/mnt" options . "$HOME/bin/mount_lib" if [[ $1 == -u ]]; then if ! mounted "$target"; then echo "Error: ${target/$HOME/~} not mounted" >&2 return 1 fi sync safe_umount "$target" else if mounted "$target"; then echo "Error: ${target/$HOME/~} is already mounted" >&2 return 1 fi echo sudo blkid -p "$1" eval local "$(/usr/bin/sudo /usr/bin/blkid -p "$1" | cut -d : -f 2-)" [[ "$TYPE" == "vfat" || "$TYPE" == "ntfs" ]] && options="uid=$UID,gid=$UID" echo sudo mount -o "$options" "$1" "$target" sudo mount -o "$options" "$1" "$target" fi } Function is in regular use, I don't know if it's useful to the topic, and needs a tweak if your user doesn't have a group with the same group id. cheers! mar77i