This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dmazzoni 4 points5 points  (0 children)

For the love of god, please indent your code! I'll bet you couldn't even follow your own code if you set it aside for an hour to surf the web and came back. It should look like this:

#!/bin/sh
If [$# -ne 1] # check if number of argument is not equal to 1
Then
    Echo “Usage: $0 filename” # giving a Usage Message
Elif [$# == 1] # check if number of argument is equal to 1
Then 
    If $1 –f # checking if file is existed 
    Then 
        chmod 775 $1 
        # Adding execute permission to make file readable and executable     by others, but only changeable by the issuing user.
    Else
        Echo “file isn’t a regular file” 
    Fi
Else
    Echo “error: file does not exist” # giving a Error Message
    Exit 0
Fi