I am writing a script where the user is asked to enter a the file name that they want to change permissions, I am stuck with if there is more then one file that comes up in the search and If the user wants to use multiple files how would I go about that.
I have set up the find command and set it that it will be stored in a path.
read -r QUESTION
if [ "$QUESTION" = 1 ];
then
echo "What is the name of the file you want to make read only?"
read -r FILENAME
find ~/ -name "$FILENAME"
PATH=$(find ~/ -name "$FILENAME")
echo
pwd
/bin/chmod -v 400 "$PATH"
fi
fi
echo
The expected output would be that a user will be able to enter multiple files to which they will be able to change the permissions for all those files in one go. If they only want to change 1 file and multiple files show up in the find they can choose their 1 file.