如何将多个命令在Shell脚本中的一个变量中组合输出?
我正在使用以下脚本获取数据库文件中的一个变量的数据
#!/bin/bash
sqlite3 pdu.db <<'END_SQL'
.timeout 2000
SELECT Variable_Value FROM Data Where Sr_No'7';
END_SQL
,现在我想将上述命令的输出存储在一个变量中。我们如何将多个命令输出存储在shell脚本中的一个变量中?
I'm using the following script to get the data of one of the variables from the database file
#!/bin/bash
sqlite3 pdu.db <<'END_SQL'
.timeout 2000
SELECT Variable_Value FROM Data Where Sr_No'7';
END_SQL
Now I wanted to store the output of the above commands in one variable. How we can store multiple commands output in one variable in the shell script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不限制将多行命令放入命令替代。
There's no restriction against putting a multiline command inside a command substitution.