Utwórz skrypt bash, który prosi użytkowników o zmianę pozwolenia
#!/bin/bash
# Did user supply an argument (path to folder?)
if [ "${1}" == "" ] ; then
echo "Directory path required as argument" && exit 1
fi
# Was the arg a valid directory?
if [ ! -d "${1}" ] ; then
echo "Directory argument was invalid" && exit 1
fi
# Re assign variable
dir="${1}"
# Get a list of files in directory
files=$(ls ${dir})
# Loop over files and ask questions
while file in "${files}" ; do
# Prompt user for permissions to be set on user/group/owner
read -p "Set permission for (u)ser/(g)roup/(o)wner? [u|g|o]" who
# Prompt user for read/write/execute permission to be set
read -p "Add read/write/execute to ${file}? [r|w|x]" ans
# Set the specified permission for the specified account type
chmod ${who}=${ans} ${file}
done