Support Support Downloads Knowledge Base Apex Support Portal Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[Junos] How to echo a blank space between outputs while running multiple CLI commands from shell

0

1

Article ID: KB35868 KB Last Updated: 26 Jun 2020Version: 1.0
Summary:

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

 

Cause:

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

 

Solution:

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

 

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search