-
-
Save staroselskii/10994648 to your computer and use it in GitHub Desktop.
lab3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ksh | |
if [ ! $# -eq 1 ] | |
then | |
echo "Wrong input" | |
exit 1 | |
fi | |
USER="$1" | |
id "$USER" 1>/dev/null 2>&1 || { echo "No such user"; exit 1; } | |
GROUPS=$(/usr/xpg4/bin/id -G -n "$USER") #get all groups | |
GROUPS=$(echo "$GROUPS" | sed -e 's/ / -o -group /g' -e 's/^/-group /g') #separate them by '-o -group' | |
{ | |
gfind . -type d -user "$USER" -perm /u=w | |
gfind . -type d -perm /g=w \( $GROUPS \) | |
gfind . -type d -perm /o=w | |
} | sort -u |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment