dotfiles/.local/bin/scripts/own

10 lines
265 B
Bash
Executable File

#!/bin/sh -e
# Recursively take ownership of the given files or the current directory
u=$USER
case "$1" in
(+*) sudo chmod -R "$1" "${@:-.}"; shift; break;;
(-*) u="${1#-}"; shift; break;;
esac
sudo chown -R --preserve-root "$u:$u" "${@:-.}"
#sudo chmod u+w . -R