我如何回声$命令没有打破布局 [英] How do I echo $command without breaking the layout

查看:114
本文介绍了我如何回声$命令没有打破布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个bash脚本如下:

I'm trying to do the following in a bash script:

com=`ssh host "ls -lh"`

echo $com

它的工作原理,但回声将打破输出(而不是让所有行一列中,我让他们都在一个行)。

It works, but the echo will break the output (instead of getting all lines in a column, I get them all in a row).

如果我做的: SSH主机LS -lh 在CLI它会给我正确的输出和布局

If I do: ssh host ls -lh in the CLI it will give me the correct output and layout.

我如何$ P $呼应变量时pserve布局?

How can I preserve the layout when echoing a variable?

推荐答案

您需要:

echo "$com"

引号使壳不破的价值成言,而是把它作为一个参数,以回声

这篇关于我如何回声$命令没有打破布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆