以下命令返回 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/
以下命令返回 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/