Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am writing a script and in the usage() function I want to specify the usage. My script uses either option1 or option2 or both. One of them is mandatory.

Is there a standard way to write it up?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

If you talk about simplest usage information optional parameters are listed in [].

For example usage section from man:

usage: man [-adfhktwW] [section] [-M path] [-P pager] [-S list]
    [-m system] [-p string] name ...

So if your script can accept option1 and option2 but they aren't mandatory you can display it like this:

script [option1] [option2]
share|improve this answer
    
Actually one of them is mandatory. –  abc Mar 6 '12 at 2:21
    
So it should be without [] –  pbm Mar 6 '12 at 6:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.