#!/bin/sh -e
#
# own - recursively take ownership of the given files or the current directory

u=${LOGNAME:-${USER}}
# shellcheck disable=SC2249
case "$1" in
  +*)
    sudo chmod -R "$1" "${@:-.}"
    shift
    ;;
  -*)
    u="${1#-}"
    shift
    ;;
esac
sudo chown -R --preserve-root "${u}:${u}" "${@:-.}"
# sudo chmod u+w . -R
