How can we change the permissions of a file in a directory

Hi All,
I am trying to wite a Shell script which changes the permission of the files in a folder but stuck at a particular point,please help.

The scenario is as follwoing:

I am having a list of 10 files and a folder which has 100 files.

I need to copare the list and the folder ,for suppose if i have only one file say some "X.ksh" common between the list and the folder,
then i need to change the permissions of all the 99 files in the folder (i.e need to ignore the common file) to 755.

Please let me know how i can solve this.

Thanks in Advance.

Regards,
Sriram.

grep with the -v option will list all the values that do not match the template.

so:

list=`ls |grep -v X.ksh`
chmod 0755 $list

Alternatively change the permissions on all files to 0755, and attempt to change the list of 10 files back to what they should be.

Hi ,

One more question how can we compare two lists say L1 and L2 and get only the lines which are extra in one of the file say L2.

Thanks in advance

If your file list is file1,file2, file3 and the directory name is 'directory', then

for i in file1 file2 file3
do
  chmod 755 directory/$i
done

The 'diff' command shows the changes that have to be made to file1 to create file2. This could include deletes as well as adds.