How-To question for the NC*SA brain trust...

John Strickler jstrick at mindspring.com
Tue Mar 16 17:11:00 EST 2004


Another simple approach is to use the shell's (bash or ksh) *read* command and put quotes around the variable

while read $x
do
     chmod o-w "$x"
done < list

This performs one chmod per file, unlike the xargs-type solutions, but has the advantage of being very tidy

-----Original Message-----
From: "Lance A. Brown" <brown9 at niehs.nih.gov>
Sent: Mar 16, 2004 4:47 PM
To: NC*SA Discussion List <ncsa-discussion at ncsysadmin.org>
Subject: Re: How-To question for the NC*SA brain trust...

What about something like:

cat $list | sed -e 's/^/"/' -e 's/$/"/' | xargs chmod o-w

This results in fewer chmod commands being executed.

I often use that sed statement while doing finds and whatnot in
directory spaces in samba shares, etc.

--[Lance]

-- 
Lance A. Brown
SysAdmin Task
LMIT ITSS Contract for 
National Institute of Environmental Health Sciences
919.361.5444x420

_______________________________________________
ncsa-discussion mailing list
ncsa-discussion at ncsysadmin.org
http://www.ncsysadmin.org/mailman/listinfo/ncsa-discussion



More information about the ncsa-discussion mailing list