How would I count the number of files in a given directory that the current user has read permissions and write permissions on ?I am starting with:echo whats the directory you want to check ?read dirnot sure then should I use a find command ? 
find number of files that I can both read and write
bash;shell;shell script
You need to ask root to get you the list of files (for the ones that are below directories you can access but not read) and then check for the rights:sudo find $dir -print0|perl -Mfiletest=access -l -0ne'++$n if-r&&-w}{print+$n'If you don't care about files that are below non-readable directories (but you can still read and write), with GNU find:find $dir -writable -readable -printf . | wc -cNote that both check the access permissions (of every type of file including directories), it's not only based on permissions. It should give you the number of files that you would successfully open in read+write mode (without creation). For instance, for symlinks for which permissions are rwxrwxrwx, it only reports those that point to a file that you have read and write permission to.