dotfiles/.local/bin/scripts/checkaccess

10 lines
264 B
Plaintext
Raw Normal View History

2021-09-18 19:53:14 +00:00
#!/bin/sh
# Checks whether the current user has rights to the respective file,
# even if it does not exist.
# First parameter defines which rights are required and is passed to "test".
dir="$2"
while ! test -e "$dir"
do dir="$(dirname "$dir")"
done
test $1 "$dir"