On Tuesday 21 February 2012, Ruediger Meier wrote:
On Monday 20 February 2012, lynn wrote:
Hi openSUSE 12.1 umask 0022
In a shared folder, we want any file created to be group rw. Using acls is not an option.
#!/bin/sh 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
But it's changing _all_ the files in the folder irrespectively: hh3:/home/CACTUS/dropbox # touch lynn lynn was changed
hh3:/home/CACTUS/dropbox # touch lynn2 lynn was changed lynn2 was changed
hh3:/home/CACTUS/dropbox # touch lynn3 lynn was changed lynn2 was changed lynn3 was changed
I thought it may be changing the timestamp: hh3:/home/CACTUS/dropbox # touch lynn4 -rw-rw---- 1 root 3000016 0 Feb 20 12:26 lynn -rw-rw---- 1 root 3000016 0 Feb 20 12:26 lynn2 -rw-rw---- 1 root 3000016 0 Feb 20 12:26 lynn3 -rw-rw---- 1 root 3000016 0 Feb 20 12:30 lynn4 but no.
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.
Thanks, L x -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org