LANCOM Support Knowledgebase Document No. 1901.1710.1557.MMÜL - V1.20

Using function keys to enhance the command line interface


This article describes how to use the command line interface (CLI) or WEBconfig to assign any command to the F1 - F12 function keys and access it from the CLI.
Requirements:




Procedure:

Assigning a CLI command to a function key:

The function key F1 is to be assigned the CLI command show bootlog. This can be done either from the CLI or from WEBconfig.


1) Assigning a command from the CLI:

1.1) Connect to the router via the CLI and log in with root privileges.

1.2) At the root level, issue enter the command cd Setup/Config/Function-Keys/ to go to the path for the function keys.

1.3) The command to assign a CLI command to a function key is set <function key> <CLI command>. If the CLI command contains space characters, it must be enclosed in quotation marks.

The command would then be: set F1 "show bootlog"

Note:
The router acknowledges the entry with the message set ok. The key assignment is also output, so you can check it directly.

root@1781VA:/Setup/Config/Function-Keys
> set F1 "show bootlog"
set ok:
Key Mapping
========---------------------------------------------------------------------------------------------------
F1 show bootlog



2) Assigning a command from WEBconfig:

2.1) Use a browser of your choice to connect to the web interface of the router (WEBconfig) and log in.

2.2) Navigate to the LCOS menu tree -> Setup -> Config -> Function keys.



2.3.) Click on Add.



2.4) In the following menu, select the Key that is to invoke the CLI command, and enter the command under Mapping.

    Important:
    WEBconfig allows you to enter commands that contain spaces without having to use quotation marks. Do not enter these characters, as they will otherwise be included in the command.



2.5) Click on Send to save the input.

    Note:
    A message is displayed confirming that your entry was successful, but the command itself is not displayed like it is after entering it at the console. To check that your entry was successful, you need to return to the path LCOS menu tree -> Setup -> Config -> Function keys.


Output the CLI command via a function key:

1) Connect to the router via the CLI and log in with root privileges.

2) Now press the function key that was programmed in step 1.3 or 2.4 respectively. The assigned command is output on the CLI. To execute the command, press the enter key.

    Note:
    The parameter ^M can also be assigned as a part of the command, i.e. assigning the command via the CLI would appear as follows: set F1 "show bootlog ^M"). The command is then executed immediately after pressing the function key.
    Catchwords: function keys; terminal; command line interface; CLI
    Please review this document! This document was helpful This document was not helpful