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

Nils Breunese nils at breun.nl
Tue Sep 23 19:15:24 UTC 2008

Rob Owens wrote:

> I know there are a lot of seasoned bash scripters on this list, so  
> here
> goes.
> 1) I need to check if the user running the script has sufficient
> permissions to write to a certain directory.

if [ -w directory ]
	<do some stuff>

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

find <directory> -name <filename>

Nils Breunese.

More information about the K12OSN mailing list