Diniz Martins

Jan 8, 20202 min

Linux scripts on Cisco IOS

The Cisco IOS Shell (IOS.sh) feature provides shell scripting capability to the Cisco IOS command-line-interface (CLI) environment. Cisco IOS.sh enhances the process of controlling and configuring an IOS router using the CLI by including, variable substitution, paths, conditional statements, loops, pipes, and so on to enhance the user experience of Cisco IOS CLI users.

These tests were performed using version 15.2(4).S4 on Cisco 7606 router.

Users have options to enable and disable the Cisco IOS.sh environment in the global configuration mode using the shell processing full command. This is the recommended option. The shell processing command without the full keyword enables the default behavior of Cisco IOS.sh to be avialble. But to enable shell processing and access all its functions, use the shell processing full command.

To enable shell processing on the terminal and to enable trace enter the following:

To disable shell processing, use the no form of the command:

To disable shell processing on the terminal enter the following:

The Cisco IOS.sh feature is integrated into the existing IOS CLI environment. This feature must be enabled either in configuration, or using a terminal command before being able to access all its functions.

After the Cisco IOS.sh is enabled, users can perform the following tasks:

• Defining and using environment variables;

• Using control constructs to automate repetitive tasks;

• Creating and using Cisco IOS.sh functions;

• Using a new set of built-in function, that provide various text processing facilities;

• Using extended pipelines to use the output of one command as input for another one;

• Evaluating logical and arithmetic expressions for tests and variable setting;

• Using online manual pages describing these changes.

Command to check "input errors" on interfaces:

This is the output if you insert the same command but without "terminal shell":

Command to save in a text file:

Using "grep" to filter the search:

Using "tail" on your log:

Command to ping hosts between 127.0.0.13 - 127.0.0.18:

    13050
    4