In a specific folder, I'm trying to count the number of files that have all three user permissions (read/write/execute). I do have files like that in my test folder, but however I try to form the condition, the result is always false.
#!/bin/bash
var="$1"
list=$(ls -d $var/*)
count=0
for x in "$list"
do
perm="$(stat -c %A $x)"
if [[ "$perm" == "-rwxrwxrwx" ]];
then ((count++))
fi
done
echo "$count"