Linux Shell 脚本 : Storing the output of a command line program

标签 linux bash shell acpi

以下命令返回 2 行,它们是我的 CPU 的温度:

acpi -t

我如何将这两行存储在 bash 脚本的变量中,以便我可以使用它们?

最佳答案

你试过吗?

var=$(acpi -t)

关于Linux Shell 脚本 : Storing the output of a command line program,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26950613/

相关文章:

linux - Cron 没有为用户运行

Python3 Websocket Callback 无法分配类成员函数

c++ - 使用 g++,如何弃用虚拟类成员函数

json - Bash,管道解析和格式化 json(瘦身)

bash - 在 Bash 中通过双反斜杠分割字符串

linux - 在bash中检测公共(public)IP地址的方法

linux - printf 从左侧填充除零以外的数字

c++ - 沙盒化可公开访问的 GCC

linux - 将plist中的字典解析为bash中的数组

macos - 找到 : -printf: unknown option