Setting Options Interactively (Units: A Unit Conversion Program and Scientific Calculator)

## 11 Setting Options Interactively ¶

Many command-line options can also be set interactively, obviating the need to quit and restart `units` to change the values. This can be especially helpful for Windows users who start `units` from a shortcut.

Typing `set` will display a list of all options that can be set interactively, as well as the current and possible values; options set to other than default values have an asterisk (‘`*`’) prepended. For example,

    You have: set
      q[uiet] = no         (y|n) do/don't suppress prompting
      o[neline] = no       (y|n) do/don't suppress the second line of output
      st[rict] = no        (y|n) do/don't suppress reciprocal unit conversion
                                 (e.g. Hz<->s)
      t[erse] = no         (y|n) do/don't give very terse output
      c[ompact] = no       (y|n) do/don't suppress printing tab, SETFLAG, and '/'
                                 characters in results
      v[erbose] = 1        (0|1|2) amount of information shown
     *d[igits] = 9         number of significant digits in output
      e[xponential] = no   (y|n) do/don't use exponential ("scientific") notation
     *f[ormat] = %.9g      printf(3) format specification
      u[nitlists] = yes    (y|n) do/don't allow conversion to unit lists
      r[ound] = no         (y|n) do/don't round last element of unit list output
                                 to an integer
      sh[owfactor] = no    (y|n) do/don't show non-unity factor before 1|x
                                 in multi-unit output

Characters within the square brackets are optional, so settings can be changed by entering only one or two characters.

The syntax for setting options is `set` option`=` value; the spaces around the ‘`=`’ sign are optional.

Some settings are Boolean, enabled by entering `yes` (or just `y`) and disabled by entering `no` (or just `n`). For example,

    You have: set quiet = y
      quiet = yes

Other settings take an integer value; for example,

    You have: set d=11
      digits = 11
      format = %.11g

The `format` setting takes a string, the format specification for the `printf` function in the C programming language; for example,

    You have: set format = %.9g
      format = %.9g

Typing `set` option will display the current value of option, for example

    You have: set u
      unitlists = yes
    You have: set d
      digits = 8
      format = %.8g

For the `digits` and `exponential` options, the value of `format` is also shown.