Need help in Shell scripting

Hi All,

I am trying to develop a program using Unix shell scripting and i stuck up at one point.

I will explain the scenario which i am working on:

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

I need to compre the file names present in the list and the folder.

For suppose if i am having only one file say some "X" common in the list and the folder then my requirement is that i need to change the permissions of all the uncommon 99 files (except the common file) in the folder to 700.

Any one plese give me a idea how i can do this.

Thanks in advance.

Regards,
Sriram.

The logic is as follows...

  1. create a file that contains the list of file names to check; file_list
  2. create a second file by performing a list of the files in the directory; dir_file_list
  3. diff file_list dir_file_list | sed -n '/> /s/> //p' > list3 creates the list of files that don't match the files in file; file_list
  4. for file in $(< list3); do chmod 700 $file;done
for FILE in $(ls dir)
do
    grep -F $FILE file_list || chmod 700 $FILE
done

Hi Frans,

I am getting the following error when i am using the command provided:

grep: illegal option -- F
Usage: grep -hblcnsviw pattern file . . .

Please let me know what needs to be done.

you can do without, it was just an arg for 'fast' grep