This article provides a method for executing CLI commands from the Shell. There may be times when you need to run CLI specific commands while in the shell prompt without going back and forth between the CLI and Shell.
There is an "alias", or shortcut command, that allows the user to execute CLI commands from the shell prompt. This is useful when troubleshooting or monitoring while in Shell.
While in shell use "cli" and then the CLI command you want to execute as follows:
root@hots:RE:0% cli show interface terse
root@:RE:0% cli show interface terse Interface Admin Link Proto Local Remote ge-0/0/0 up down ge-0/0/0.0 up down eth-switch ge-0/0/1 up down ge-0/0/1.0 up down eth-switch ge-0/0/2 up up ge-0/0/2.0 up up eth-switch ge-0/0/3 up up ge-0/0/3.0 up up eth-switch ge-0/0/4 up down ge-0/0/5 up up ge-0/0/5.0 up up eth-switch ge-0/0/6 up down ge-0/0/7 up down ge-0/0/8 up down ge-0/0/9 up down ge-0/0/10 up down ge-0/0/11 up down
root@host:RE:0% cli show interface terse | grep inet
bme0.32768 up up inet 126.96.36.199/2 lo0.0 up up inet vlan.0 up up inet vlan.804 up up inet 10.127.1.32/24 vme.0 up up inet 10.85.33.208/24
root@host:RE:0% cli show interface terse | match inet match: Command not found. cli: remote side unexpectedly closed connection
NOTE: The above failure example points out the use of the "pipe" command with "grep"; but with "match", please include double quotes as shown below.
root@:RE:0% cli show interface terse "|" match inet
bme0.32768 up up inet 188.8.131.52/2 bme0.36862 up up inet 184.108.40.206/2