Questions tagged [options]

Passing options like -l or --word to commands, or parsing them in scripts.

Use this tag for questions about options for shell commands: passing them and parsing them.

There are three common variants of option syntax; different commands use different syntax.

  • POSIX: This is the traditional Unix style. Options consists of a - (dash a.k.a. minus) followed by a single letter. If - is followed by multiple letters, each letter is an option (this is called bundling). Example: ls -la is equivalent to ls -l -a.
    An option can take an argument, which is either in the next word or glued to the option. Example: sort -st: is equivalent to sort -s -t :.
  • GNU: in addition to the POSIX syntax, options can start with -- and consist of multiple letters. Arguments are either given after a = or in the next word. Example: sort --stable --field-separator=: is equivalent to sort --stable --field-separator :.
  • Multi-letter: an option consists of a - followed by more characters (usually letters and dashes). If there is an argument, it is in the next word. Example: xterm -name foo -e foo

Further reading

338 questions
18
votes
2 answers

Why can spaces between options and parameters be omitted?

For example: xargs -n 1 is the same as xargs -n1 But if you look at the man page, the option is listed as -n max-args, which means the space is supposed to be preserved. There is nothing about the abbreviated form -nmax-args. This also happens…
J.Joe
  • 283
2
votes
1 answer

What are the differences between command options and switches?

From Java in a Nutshell: The syntax of the jar command is intentionally very similar to that of the Unix tar command. This similarity is the reason why jar uses command options, rather than switches (as the other Java platform commands…
Tim
  • 101,790
1
vote
1 answer

What are the possible objdump demangle styles?

The manpage for objdump states: --demangle[=style] ... The optional demangling style argument can be used to choose an appropriate demangling style for your compiler. Nowhere does it mention what possible styles are recognized by the…
0
votes
3 answers

Difference between -q and --quiet?

I was wondering: What is the difference between -q and --quiet? And in which case do I use -q and --quiet? Thank you!
0
votes
1 answer

getopt optional argument with optional value

I am using getopt and want to have an option -l that takes an optional value. I am finding that when matching -l by itself with no argument value provided, I still have to use shift 2 rather than just one shift. What is going on and how does this…
Vera
  • 1,223
0
votes
2 answers

What are the -i and -o options of wlconf for?

Version = 1.2 # defaults binary_name="/lib/firmware/ti-connectivity/wl18xx-conf.bin" wlconf_path="/usr/sbin/wlconf/" ini_path="/usr/sbin/wlconf/official_inis" {body of code} basically, the user answers questions like "How many antennas are…
kam654
  • 11