[K12OSN] OT: bash scripting - check for permissions, check for existence of file in directory tree

Rob Owens rob.owens at biochemfluidics.com
Tue Sep 23 19:06:38 UTC 2008

I know there are a lot of seasoned bash scripters on this list, so here

1) I need to check if the user running the script has sufficient
permissions to write to a certain directory.

2) I need to check for the existence of a file somewhere in a directory
tree (with lots of subdirectories).

I can think of some rather convoluted ways of achieving these two tasks,
but I'm sure somebody here knows a better way.  Thanks in advance for
your suggestions.


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If you are not the addressee, any disclosure, reproduction,
copying, distribution, or other dissemination or use of this transmission in
error please notify the sender immediately and then delete this e-mail.
E-mail transmission cannot be guaranteed to be secure or error free as
information could be intercepted, corrupted lost, destroyed, arrive late or
incomplete, or contain viruses.
The sender therefore does not accept liability for any errors or omissions
in the contents of this message which arise as a result of e-mail
transmission. If verification is required please request a hard copy


More information about the K12OSN mailing list