I am writing a script that downloads packages to a specific folder. However, I want to make it possible for all users to download packages to that folder and use any packages installed there. How do I do that? I want to check/change the permission for the /usr/local/src folder. I don't know how I've to use the if/else statement properly. In text it'll look like (I guess): if stat/permission of src folder isn't 777 then chmod to 777
Check/change folder permission in shell script
shell script;permissions
You can use stat -c %a /usr/local/src to get the full permissions. But you should consider 1777 instead of 777.So something likeif [ $(stat -c '%a' /usr/local/src) == 777 ]then  # somethingelse  # something elsefiIn answer to your other question, if the permissions are already 777 then there will be no effect.EDIT: corrected typos. @Alexej Magura why would I use double brackets? As far as I'm aware that would turn it into an arithmetic expression ..