I'm attempting to create a bash script where I check if all the files of a specific folder (/tmp) have the permission 755. I also need it to delete all the files that don't have permission value 755.
I've attempted this so far with no luck:
#!/bin/bash for filename in 'ls' do if [ -perm 0755 "$filename" ] then echo "Files with 755 permission: $filename" else rm "$filename" fi done echo "###DONE###"
Any help you can provide will be greatly appreciated! :-)