Description

This article explains how to echo a blank space between outputs while running multiple CLI commands in a single line from shell prompt.

 

Symptoms

While running a command, the output gets printed as follows without any space in between. 

labroot@jtac-mx480-r2045-re0> start shell sh command "cli -c 'sh chassis alarms;sh system core-dumps'"                 
2 alarms currently active
Alarm time               Class  Description
2020-05-01 11:56:56 IST  Major  PEM 3 Input Failure
2020-05-01 11:56:56 IST  Major  PEM 3 Not OK
/var/crash/*core*: No such file or directory
/var/tmp/*core*: No such file or directory
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
/tftpboot/corefiles/*core*: No such file or directory

 

Solution

A space printed between command outputs would give a cleaner look to the outputs and make them easily and understandable.

 

To print a space in between command outputs, use echo \"\" in the CLI commands as shown below:

labroot@jtac-mx480-r2045-re0> start shell sh command "cli -c 'sh chass alarm';echo \"\";cli -c 'show system core-dumps'"   
2 alarms currently active
Alarm time               Class  Description
2020-05-01 11:56:56 IST  Major  PEM 3 Input Failure
2020-05-01 11:56:56 IST  Major  PEM 3 Not OK

/var/crash/*core*: No such file or directory
/var/tmp/*core*: No such file or directory
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
/tftpboot/corefiles/*core*: No such file or directory