Hi, I'm try to write a bash file that searches for all file names and then outputs whether those files are readable, writable and or executable. I managed to get this working when I manually input the file names but I want it to search for all file names in all subdirectories and I'm not sure what's wrong with the code. It would be greatly appreciated if you could let me know what I've done wrong.
#!/bin/bash
files=$({find. -type f ;})
for var in "$files"do
# find out if file has write permission or not
[ -w $var ] && W="Write = yes" || W="Write = No"
# find out if file has excute permission or not
[ -x $var ] && X="Execute = yes" || X="Execute = No"
# find out if file has read permission or not
[ -r $var ] && R="Read = yes" || R="Read = No"
echo "File name: $var"
echo "$W"
echo "$R"
echo "$X"
done