samedi 29 novembre 2014

Unix Write a program that accepts a directory name on the command line?


he program checks that there is exactly one command line argument, then calls a sub. The sub finds all files in the directory that have 700 access permission (the owner has full permission, group and other users have no permission), and changes the access rights for these files so that everyone else can read the file (744 permission). The sub then prints the name and new access rights of all the changed files.


For added challenge, you may write this program without using a loop. Sample output:


$ ls -l dir1 total 5 -rw-rw-rw- 1 ucn2140 staff 1970 Mar 3 16:24 lab3 -rw-rw-rw- 1 ucn2140 staff 298 Mar 3 16:24 lab3.soln1 -rw-rw-rw- 1 ucn2140 staff 306 Mar 3 16:24 lab3.soln2 -rwx------ 1 ucn2140 staff 553 Mar 3 17:21 lab4.soln1 -rwx------ 1 ucn2140 staff 180 Mar 3 17:21 lab4.soln2 $ lab6.soln2 dir1 dir1/lab4.soln1 744 dir1/lab4.soln2 744 $ lab6.soln2 Usage: lab6.soln2 dirname



Aucun commentaire:

Enregistrer un commentaire