Peper schrieb: > Hello, > How can i check whether i can create or overwrite a file?
You need write access on the directory for creating files and on the file for overwriting. > For example: > If /etc/conf.d/net cannot be overwritten or created it return false. Use "test" or "[" or "[[". > Overwriting test would be -w /etc/conf.d/net, Yep. > but how can i check if i can > create this file? [[ -w `dirname /etc/conf.d/net` ]] && echo can create file > I could check whether i can create new files > in /etc/conf.d, Yep. > but how can i get /etc/conf.d/ from /etc/conf.d/net ? dirname. Or if you've got that in an environment variable, you use "Parameter Expansion". file=/etc/conf.d/net echo ${file%/*} Alexander Skwar -- gentoo-user@gentoo.org mailing list