type=page
status=published
title=multimode
next=osgi.html
prev=monitor.html
~~~~~~

= multimode

[[multimode-1]][[GSRFM00213]][[multimode]]

== multimode

Allows multiple subcommands to be run while preserving environment
settings and remaining in the asadmin utility

[[sthref1900]]

=== Synopsis

[source]
----
asadmin [asadmin-options] multimode [--help]
[--file filename]
[--printprompt={true|false}] [--encoding encode]
----

[[sthref1901]]

=== Description

The `multimode` subcommand processes `asadmin` subcommands sequentially
in a single session. The command-line interface prompts for a
subcommand, runs that subcommand, displays the results of that
subcommand, and then prompts for the next subcommand. All the `asadmin`
options set in multimode apply to subsequent commands until the
multimode session is exited. You exit `multimode` by typing `exit`,
`quit`, or Ctrl-D.

You can use the `export` subcommand to set your environment, or use the
`unset` subcommand to remove environment variables from the multimode
environment.

You can also provide subcommands by passing a previously prepared list
of subcommands from a file or standard input (pipe). When you use a
file, you can include comment lines in the file by entering the hash
symbol (`#`) as the first character of the line.

You can invoke `multimode` from within a multimode session. When you
exit the second multimode environment, you return to your original
multimode environment.

All the remote `asadmin` utility options can be supplied when invoking
the `multimode` subcommand. The settings will apply as defaults for all
subcommands that are run within the multimode session. For a list of the
`asadmin` utility options, see the
link:asadmin.html#asadmin-1m[`asadmin`(1M)] help page.

[[sthref1902]]

=== Options

asadmin-options::
  Options for the `asadmin` utility. For information about these
  options, see the link:asadmin.html#asadmin-1m[`asadmin`(1M)] help page.
`--help`::
`-?`::
  Displays the help text for the subcommand.
`--file`::
`-f`::
  Reads the subcommands in the specified file.
`--printprompt`::
  Controls printing of the `asadmin` prompt. By default, this option is
  set to the same value as the `--interactive` `asadmin` utility option.
  Normally you will not need to specify this option. Default is true.
`--encoding`::
  Specifies the character set for the file to be decoded. By default,
  the system character set is used.

[[sthref1903]]

=== Examples

[[GSRFM725]][[sthref1904]]

==== Example 1   Starting a Multimode Session

This example starts a multimode session where: `%` is the system prompt.

[source]
----
% asadmin multimode
asadmin>
----

You can also start a multimode session by typing `asadmin` without
options or subcommands at the system prompt.

[[GSRFM726]][[sthref1905]]

==== Example 2   Running Multiple Commands From a File

This example runs a sequence of subcommands from the `commands_file.txt`
file.

[source]
----
% asadmin multimode --file commands_file.txt
----

[[sthref1906]]

=== Exit Status

0::
  subcommand executed successfully
1::
  error in executing the subcommand

[[sthref1907]]

=== See Also

link:asadmin.html#asadmin-1m[`asadmin`(1M)]

link:export.html#export-1[`export`(1)],
link:unset.html#unset-1[`unset`(1)]


