Skip to content

Instantly share code, notes, and snippets.

@pixie79
Last active January 23, 2017 15:36
Show Gist options
  • Save pixie79/6e8b6c24f3f50e12565ffbc5a34ba5ae to your computer and use it in GitHub Desktop.
Save pixie79/6e8b6c24f3f50e12565ffbc5a34ba5ae to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eux -o pipefail
USBDISK="${NONE:-$1}"
if [[ "${USER}" == root ]]
then
USER="${SUDO_USER}"
fi
DISK="/media/${USER}/${USBDISK}"
echo "Changing Ownership on /media/${USER}/${USBDISK} for user: ${USER}"
if [[ -d "${DISK}" ]]
then
cd "${DISK}"
if [[ $(pwd) == ${DISK} ]]
then
echo "Changing"
#chown -R ${USER} "${DISK}"
exit
else
echo "Dont trick me with bad path"
exit 2
fi
else
echo "Disk not found"
exit 2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment