On 21/02/12 01:37, Ruediger Meier wrote:
On Tuesday 21 February 2012, Ruediger Meier wrote:
On Monday 20 February 2012, lynn wrote:
share=/home/CACTUS/dropbox/ cd $share wihile true do if [ -N $share ]; then for a in * do if [ -N $a ]; then echo $(chmod g+w $a) echo "$a was changed" fi done fi sleep 4 done
B
Each time only one file has been modified. Why does it change _all_ of the files? Just change only files without the wanted permissions find "$share" ! -perm -g=w -print0 | xargs -0 chmod g+w better find "$share" ! -perm -g=w -print0 | xargs -r -0 chmod g+w to avoid error if no file is found.
This also corrects any quoting issues in case there are strange file names.
Very neat. Should I test before doing the find? #!/bin/sh share=/home/CACTUS/dropbox/ while true do if [ -N $share ]; then find "$share" ! -perm -g=w -print0 | xargs -r -0 chmod g+w fi sleep 4 done As the other files will already be rw, is there a way to 'only do the find if a new file has been created'? Thanks, L x -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org