1

What is the convention for showing the usage of a bash script ? Below is the help output for my script

Usage: my_script [options] [PORT]

Options:
    --help      print help and exit
    --version   print version and exit

Am i right in thinking that [ ] means optional

How do I signify an optional argument and a mandatory argument ?

lafferc
  • 2,741
  • 3
  • 24
  • 37

1 Answers1

1

A couple of commandline tools that i use frequently is "find" and "grep". While find runs happy without any parameters (all parameters are optional) grep needs at least a pattern. In case grep is invoked with no paramters at all it prints usage information like follows

Aufruf: grep [OPTION]... MUSTER [DATEI]...
"grep --help" liefert weitere Informationen.

Where MUSTER is the german word for pattern.

Matthias
  • 3,458
  • 4
  • 27
  • 46