-
C File permissions
I am trying to do this task but dont seem to be getting any where can any1 help?
Write a C shell script, exe, which changes the permissions of a file to make it executable by anyone.
Usage
The script takes one parameter and should be called as follows:
exe filename
Output
Your script should use the chmod command to change the permissions of the file.
Your script should output a message to the user to indicate that the file’s permissions have been changed.
Your script should output an error message if any of the following error conditions occurs:
• the user calls the script with the wrong number of parameters
• the file does not exist
• the file is not an ordinary file
thanks in advance.
-
Since you haven't posted any code to show an attempt and it should a lot like homework this is all the hint you'll get for now:
Code:
sprintf(buffer, "chmod %s", argv[1]);
system(buffer);
Before it just do the error checking on the number of parameters, file existing, file type.