#!/bin/bash set -e dash_found= for arg in "$@"; do if [ -z "${arg##-*}" ]; then dash_found=true break fi done if [ "$#" -gt 0 ]; then if [ -n "$dash_found" ]; then exec /usr/bin/pumount "$@" fi for arg in "$@"; do /usr/bin/pumount "$arg" done exit 0 fi cd /media/ mps=(*) if [ ${#mps[@]} -eq 0 ]; then echo "Nothing to be done." exit 0 fi if [ ${#mps[@]} -eq 1 ]; then if [ "${mps[0]}" == "*" ]; then echo "Nothing to be done." exit 0 fi echo "unmounting /media/${mps[0]}" exec /usr/bin/pumount "/media/${mps[0]}" fi select mp in ${mps[*]}; do echo "unmounting /media/$mp" exec /usr/bin/pumount "/media/$mp" done